--- /dev/null
+/*++\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
+Module Name:\r
+ EdkException.java\r
+\r
+Abstract:\r
+\r
+--*/\r
+package org.tianocore.exception;\r
+\r
+public class EdkException extends Exception {\r
+ private StackTraceElement[] stackTrace;\r
+ public static boolean isPrintStack = false;\r
+\r
+ public EdkException(String message) {\r
+ super("[EdkException]:" + message);\r
+ }\r
+\r
+ public EdkException(String message, boolean traceStack) {\r
+ super(message);\r
+ \r
+ }\r
+ \r
+ public EdkException(){\r
+ super();\r
+ }\r
+ \r
+ public EdkException(Exception e, String message){\r
+ super("[EdkException]:" + message);\r
+ if (isPrintStack){\r
+ this.setStackTrace(e.getStackTrace());\r
+ }\r
+ e.printStackTrace();\r
+ }\r
+ public static void setIsprintStack (boolean flag){\r
+ isPrintStack = flag;\r
+ }\r
+}\r
--- /dev/null
+/*++\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
+Module Name:\r
+ DefaultLogger.java\r
+\r
+Abstract:\r
+\r
+--*/\r
+\r
+package org.tianocore.logger;\r
+import java.util.logging.Level;\r
+import java.util.logging.Logger;\r
+\r
+class DefaultLogger implements LogMethod {\r
+ private Logger logger = Logger.global;\r
+ private static Level[] levelMap = {\r
+ Level.SEVERE, Level.WARNING, Level.INFO, Level.FINE, Level.ALL\r
+ };\r
+\r
+ public DefaultLogger() {\r
+\r
+ }\r
+\r
+ public void putMessage(Object msgSource, int msgLevel, String msg) {\r
+ logger.log(levelMap[msgLevel], msg);\r
+ }\r
+}
\ No newline at end of file
--- /dev/null
+/*++\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
+Module Name:\r
+ EdkLogger.java\r
+\r
+Abstract:\r
+\r
+--*/\r
+package org.tianocore.logger;\r
+\r
+import org.tianocore.logger.LogMethod;\r
+\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
+ \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
+ public static final int EDK_VERBOSE = 3;\r
+ public static final int EDK_DEBUG = 4;\r
+\r
+ private static int logLevel = EDK_INFO;\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
+ }\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
+ }\r
+\r
+ public static void log(Exception cause) {\r
+\r
+ }\r
+\r
+ public static void setLogger(LogMethod l) {\r
+ logger = l;\r
+ }\r
+ \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 int getLogLevel (){\r
+ return logLevel;\r
+ }\r
+}\r
+\r
+\r
--- /dev/null
+/*++\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
+Module Name:\r
+ LogMethod.java\r
+\r
+Abstract:\r
+\r
+--*/\r
+package org.tianocore.logger;\r
+\r
+\r
+public interface LogMethod {\r
+ public void putMessage(Object msgSource, int msgLevel, String msg);\r
+}\r
--- /dev/null
+/*++\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
+Module Name:\r
+ GenBuildLogger.java\r
+\r
+Abstract:\r
+\r
+--*/\r
+\r
+package org.tianocore.build.global;\r
+import org.apache.tools.ant.Project;\r
+import org.tianocore.logger.LogMethod;\r
+\r
+class GenBuildLogger implements LogMethod {\r
+ private Project project;\r
+ public GenBuildLogger(Project project) {\r
+ this.project = project;\r
+ \r
+ }\r
+\r
+ public void putMessage(Object msgSource, int msgLevel, String msg) {\r
+ this.project.log(msg, Project.MSG_INFO);\r
+ }\r
+}
\ No newline at end of file