]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Log.java
Restructuring for better separation of Tool packages.
[mirror_edk2.git] / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / common / Log.java
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Log.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Log.java
deleted file mode 100644 (file)
index 0607658..0000000
+++ /dev/null
@@ -1,255 +0,0 @@
-/** @file\r
\r
- The file is used to provides static interfaces to save log and error information \r
\r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution.  The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
- **/\r
-\r
-package org.tianocore.frameworkwizard.common;\r
-\r
-import java.io.File;\r
-import java.io.FileNotFoundException;\r
-import java.io.FileOutputStream;\r
-import java.io.IOException;\r
-\r
-import javax.swing.JOptionPane;\r
-\r
-/**\r
- The class is used to provides static interfaces to save log and error information\r
\r
- **/\r
-public class Log {\r
-\r
-    //\r
-    //Log file\r
-    //\r
-    private static File fleLogFile = null;\r
-\r
-    //\r
-    //Wrn file\r
-    //\r
-    private static File fleWrnFile = null;\r
-\r
-    //\r
-    //Err file\r
-    //\r
-    private static File fleErrFile = null;\r
-\r
-    //\r
-    //Log file name\r
-    //\r
-    static String strLogFileName = "Log.log";\r
-\r
-    //\r
-    //Wrn file name\r
-    //\r
-    static String strWrnFileName = "Wrn.log";\r
-\r
-    //\r
-    //Err file name\r
-    //\r
-    static String strErrFileName = "Err.log";\r
-\r
-    /**\r
-     Main class, used for test\r
-     \r
-     @param args\r
-     \r
-     **/\r
-    public static void main(String[] args) {\r
-        try {\r
-            //Log.log("Test", "test");\r
-            //Log.err("Test1", "test1");\r
-            Log\r
-               .wrn("aaa bbbbbb cccccccccccc ddddddddddd eeeeeeeeee fffffffffff gggggggggggggggggg hhhhhhhhhhhhhhhhhhhhhhhhhhhhh iiiii jjjj kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk lll mmm nn poooooooooooooooooooooooooooooooooooooooooooop");\r
-            Log.wrn("Incorrect data type for ModuleEntryPoint");\r
-        } catch (Exception e) {\r
-            e.printStackTrace();\r
-        }\r
-    }\r
-\r
-    /**\r
-     Call writeToLogFile to save log item and log information to log file\r
-     \r
-     @param strItem The log item\r
-     @param strLog The log information\r
-     \r
-     **/\r
-    public static void log(String strItem, String strLog) {\r
-        try {\r
-            writeToLogFile(strItem + ":" + strLog);\r
-        } catch (IOException e) {\r
-            e.printStackTrace();\r
-        }\r
-    }\r
-\r
-    /**\r
-     Call writeToLogFile to save log information to log file\r
-     \r
-     @param strLog The log information\r
-     \r
-     **/\r
-    public static void log(String strLog) {\r
-        try {\r
-            writeToLogFile(strLog);\r
-        } catch (IOException e) {\r
-            e.printStackTrace();\r
-        }\r
-    }\r
-\r
-    /**\r
-     Call writeToWrnFile to save wrn item and wrn information to wrn file\r
-     \r
-     @param strItem The wrn item\r
-     @param strLog The wrn information\r
-     \r
-     **/\r
-    public static void wrn(String strItem, String strWrn) {\r
-        try {\r
-            writeToWrnFile("Warning when " + strItem + "::" + strWrn);\r
-            showWrnMessage(strWrn);\r
-        } catch (IOException e) {\r
-            e.printStackTrace();\r
-        }\r
-    }\r
-\r
-    /**\r
-     Call writeToWrnFile to save wrn information to wrn file\r
-     \r
-     @param strLog The wrn information\r
-     \r
-     **/\r
-    public static void wrn(String strWrn) {\r
-        try {\r
-            writeToWrnFile("Warning::" + strWrn);\r
-            showWrnMessage("Warning::" + strWrn);\r
-        } catch (IOException e) {\r
-            e.printStackTrace();\r
-        }\r
-    }\r
-\r
-    /**\r
-     Call writeToErrFile to save err item and err information to err file\r
-     \r
-     @param strItem The err item\r
-     @param strLog The err information\r
-     \r
-     **/\r
-    public static void err(String strItem, String strErr) {\r
-        try {\r
-            writeToErrFile("Error when " + strItem + "::" + strErr);\r
-        } catch (IOException e) {\r
-            e.printStackTrace();\r
-        }\r
-    }\r
-\r
-    /**\r
-     Call writeToErrFile to save err information to err file\r
-     \r
-     @param strLog The err information\r
-     \r
-     **/\r
-    public static void err(String strErr) {\r
-        try {\r
-            writeToErrFile("Error::" + strErr);\r
-        } catch (IOException e) {\r
-            e.printStackTrace();\r
-        }\r
-    }\r
-\r
-    /**\r
-     Brings up a dialog to show err message\r
-     When the message's length > defined max length, wrap the text to the next line.\r
-     \r
-     @param strErr The input data of err message\r
-     \r
-     **/\r
-    private static void showWrnMessage(String strErr) {\r
-        String strReturn = Tools.wrapStringByWord(strErr);\r
-        JOptionPane\r
-                   .showConfirmDialog(null, strReturn, "Warning", JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE);\r
-    }\r
-\r
-    /**\r
-     Open log file and write log information\r
-     \r
-     @param strLog The log information\r
-     @throws IOException\r
-     \r
-     **/\r
-    private static void writeToLogFile(String strLog) throws IOException {\r
-        try {\r
-            if (fleLogFile == null) {\r
-                fleLogFile = new File(strLogFileName);\r
-                fleLogFile.createNewFile();\r
-            }\r
-            FileOutputStream fos = new FileOutputStream(fleLogFile, true);\r
-            fos.write((Tools.getCurrentDateTime() + DataType.DOS_LINE_SEPARATOR).getBytes());\r
-            fos.write((strLog + DataType.DOS_LINE_SEPARATOR).getBytes());\r
-            fos.flush();\r
-            fos.close();\r
-        } catch (FileNotFoundException e) {\r
-            e.printStackTrace();\r
-        } catch (IOException e) {\r
-            e.printStackTrace();\r
-        }\r
-    }\r
-\r
-    /**\r
-     Open wrn file and write wrn information\r
-     \r
-     @param strLog The log information\r
-     @throws IOException\r
-     \r
-     **/\r
-    private static void writeToWrnFile(String strLog) throws IOException {\r
-        try {\r
-            if (fleWrnFile == null) {\r
-                fleWrnFile = new File(strWrnFileName);\r
-                fleWrnFile.createNewFile();\r
-            }\r
-            FileOutputStream fos = new FileOutputStream(fleWrnFile, true);\r
-            fos.write((Tools.getCurrentDateTime() + DataType.DOS_LINE_SEPARATOR).getBytes());\r
-            fos.write((strLog + DataType.DOS_LINE_SEPARATOR).getBytes());\r
-            fos.flush();\r
-            fos.close();\r
-        } catch (FileNotFoundException e) {\r
-            e.printStackTrace();\r
-        } catch (IOException e) {\r
-            e.printStackTrace();\r
-        }\r
-    }\r
-\r
-    /**\r
-     Open err file and write err information\r
-     \r
-     @param strLog The log information\r
-     @throws IOException\r
-     \r
-     **/\r
-    private static void writeToErrFile(String strLog) throws IOException {\r
-        try {\r
-            if (fleErrFile == null) {\r
-                fleErrFile = new File(strErrFileName);\r
-                fleErrFile.createNewFile();\r
-            }\r
-            FileOutputStream fos = new FileOutputStream(fleErrFile, true);\r
-            fos.write((Tools.getCurrentDateTime() + DataType.DOS_LINE_SEPARATOR).getBytes());\r
-            fos.write((strLog + DataType.DOS_LINE_SEPARATOR).getBytes());\r
-            fos.flush();\r
-            fos.close();\r
-        } catch (FileNotFoundException e) {\r
-            e.printStackTrace();\r
-        } catch (IOException e) {\r
-            e.printStackTrace();\r
-        }\r
-    }\r
-}\r