]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/ModuleEditor/src/org/tianocore/common/Log.java
Remove ModuleEditor and PackageEditor from Tools\Source
[mirror_edk2.git] / Tools / Source / ModuleEditor / src / org / tianocore / common / Log.java
diff --git a/Tools/Source/ModuleEditor/src/org/tianocore/common/Log.java b/Tools/Source/ModuleEditor/src/org/tianocore/common/Log.java
deleted file mode 100644 (file)
index 0759fc6..0000000
+++ /dev/null
@@ -1,211 +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.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
- @since ModuleEditor 1.0\r
\r
- **/\r
-public class Log {\r
-\r
-    //\r
-    //Log file\r
-    //\r
-    private static File fleLogFile = 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
-    //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.err("sdfsdfsd fsdfsdfsdfsdfj dsfksdjflsdjf sdkfjsdklfjsdkf dskfsjdkfjks dskfjsdklfjsdkf sdkfjsdlf sdkfjsdk kdfjskdf sdkfjsdkf ksdjfksdfjskdf sdkfsjdfksd fskdfjsdf", "dfsdf sdfksdf sd sdfksd fsdf");\r
-        } catch (Exception e) {\r
-            e.printStackTrace();\r
-        }\r
-    }\r
-\r
-    /**\r
-     This is the default constructor\r
-     Do nothing\r
-     \r
-     **/\r
-    public Log() {\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 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
-            showErrMessage("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
-            showErrMessage("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 showErrMessage(String strErr) {\r
-        int intMaxLength = 40;\r
-        String strReturn = "";\r
-        String strTemp = "";\r
-        while (strErr.length() > 0) {\r
-            if (strErr.length() > intMaxLength) {\r
-                strTemp = strErr.substring(0, intMaxLength);\r
-                strErr = strErr.substring(strTemp.length());\r
-                strReturn = strReturn + strTemp + DataType.UNXI_LINE_SEPARATOR;\r
-                \r
-            } else if (strErr.length() <= intMaxLength) {\r
-                strReturn = strReturn + strErr;\r
-                strErr = "";\r
-            }\r
-        }\r
-        JOptionPane.showConfirmDialog(null, strReturn, "Error", 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 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