]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/Common/org/tianocore/common/logger/EdkLog.java
Add two definitions to ToolDefinitions. Enhance EdkLog and GenBuildLogger. GenBuildLo...
[mirror_edk2.git] / Tools / Source / Common / org / tianocore / common / logger / EdkLog.java
index 220b9899f76386e49a710c971b299817e44d9653..cfa7d53e4a619492228377fa46e3415edb853bf3 100644 (file)
 /*++\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
+ 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
+ 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
-Module Name:\r
 EdkLogger.java\r
+ Module Name:\r
+ EdkLogger.java\r
 \r
-Abstract:\r
-\r
---*/\r
+ Abstract:\r
 \r
+ --*/\r
 package org.tianocore.common.logger;\r
 \r
-import org.tianocore.common.logger.LogMethod;\r
+import java.io.File;\r
 \r
 public class EdkLog {\r
-    private static final String error    = "ERROR";\r
-    private static final String warning  = "WARNING";\r
-    private static final String info     = "INFO";\r
-    private static final String verbose  = "VERBOSE";\r
-    private static final String debug    = "DEBUG";\r
+    public static final String always = "ALWAYS";\r
+\r
+    public static final String error = "ERROR";\r
+\r
+    public static final String warning = "WARNING";\r
+\r
+    public static final String info = "INFO";\r
+\r
+    public static final String verbose = "VERBOSE";\r
+\r
+    public static final String debug = "DEBUG";\r
+\r
+    public static final int EDK_ALWAYS = -1;\r
+\r
+    public static final int EDK_ERROR = 0;\r
 \r
-    public static final int EDK_ERROR   = 0;\r
     public static final int EDK_WARNING = 1;\r
-    public static final int EDK_INFO    = 2;\r
+\r
+    public static final int EDK_INFO = 2;\r
+\r
     public static final int EDK_VERBOSE = 3;\r
-    public static final int EDK_DEBUG   = 4;\r
+\r
+    public static final int EDK_DEBUG = 4;\r
 \r
     private static int logLevel = EDK_INFO;\r
+\r
     private static LogMethod logger = new DefaultLogger();\r
 \r
     public static void log(int level, String message) {\r
-        if (level <= logLevel){\r
-            logger.putMessage(null, logLevel, message);\r
+        if (level <= logLevel) {\r
+            logger.putMessage(null, level, message);\r
         }\r
-\r
     }\r
 \r
-    public static void log(int logLevel, String message, Exception cause) {\r
-\r
-    }\r
-\r
-    public static void log(int logLevel, Exception cause) {\r
-\r
+    public static void log(String message) {\r
+        if (EDK_INFO <= logLevel) {\r
+            logger.putMessage(null, EDK_INFO, message);\r
+        }\r
     }\r
 \r
-    public static void log(Exception cause) {\r
-\r
+    public static void flushLogToFile(File file) {\r
+        logger.flushToFile(file);\r
     }\r
 \r
     public static void setLogger(LogMethod l) {\r
         logger = l;\r
     }\r
 \r
-    public static void setLogLevel (int level){\r
+    public static void setLogLevel(int level) {\r
         logLevel = level;\r
     }\r
-    public static void setLogLevel (String level){\r
-       if (level == null){\r
-           return;\r
-       }\r
-       String levelStr = level.trim();\r
-       if (levelStr.equalsIgnoreCase(error)){\r
-           logLevel = EDK_ERROR;\r
-       }\r
-       if (levelStr.equalsIgnoreCase(debug)){\r
-           logLevel = EDK_DEBUG;\r
-       }\r
-       if (levelStr.equalsIgnoreCase(info)){\r
-           logLevel = EDK_INFO;\r
-       }\r
-       if (levelStr.equalsIgnoreCase(verbose)){\r
-           logLevel = EDK_VERBOSE;\r
-       }\r
-       if (levelStr.equalsIgnoreCase(warning)){\r
-           logLevel = EDK_WARNING;\r
-       }\r
+\r
+    public static void setLogLevel(String level) {\r
+        if (level == null) {\r
+            return;\r
+        }\r
+        String levelStr = level.trim();\r
+        if (levelStr.equalsIgnoreCase(error)) {\r
+            logLevel = EDK_ERROR;\r
+        }\r
+        if (levelStr.equalsIgnoreCase(debug)) {\r
+            logLevel = EDK_DEBUG;\r
+        }\r
+        if (levelStr.equalsIgnoreCase(info)) {\r
+            logLevel = EDK_INFO;\r
+        }\r
+        if (levelStr.equalsIgnoreCase(verbose)) {\r
+            logLevel = EDK_VERBOSE;\r
+        }\r
+        if (levelStr.equalsIgnoreCase(warning)) {\r
+            logLevel = EDK_WARNING;\r
+        }\r
     }\r
-    public static int getLogLevel (){\r
+\r
+    public static int getLogLevel() {\r
         return logLevel;\r
     }\r
 }\r
-\r
-\r