Add two definitions to ToolDefinitions. Enhance EdkLog and GenBuildLogger. GenBuildLogger contains two behaviors now, one is for normal; while another is for multi-thread. (4)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1450 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -97,4 +97,7 @@ public class ToolDefinitions {
|
||||
public final static String TARGET_KEY_TOOLCHAIN = "TOOL_CHAIN_TAG";
|
||||
public final static String TARGET_KEY_ARCH = "TARGET_ARCH";
|
||||
public final static String TARGET_KEY_TOOLS_DEF = "TOOL_CHAIN_CONF";
|
||||
public final static String TARGET_KEY_MULTIPLE_THREAD = "MULTIPLE_THREAD";
|
||||
public final static String TARGET_KEY_MAX_CONCURRENT_THREAD_NUMBER
|
||||
= "MAX_CONCURRENT_THREAD_NUMBER";
|
||||
}
|
||||
|
@@ -20,7 +20,7 @@ package org.tianocore.common.exception;
|
||||
|
||||
public class EdkException extends Exception {
|
||||
static final long serialVersionUID = -8494188017252114029L;
|
||||
private StackTraceElement[] stackTrace;
|
||||
|
||||
public static boolean isPrintStack = false;
|
||||
|
||||
public EdkException(String message) {
|
||||
|
@@ -18,6 +18,7 @@ Abstract:
|
||||
|
||||
package org.tianocore.common.logger;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@@ -28,10 +29,16 @@ class DefaultLogger implements LogMethod {
|
||||
};
|
||||
|
||||
public DefaultLogger() {
|
||||
|
||||
}
|
||||
|
||||
public void putMessage(Object msgSource, int msgLevel, String msg) {
|
||||
if (msgLevel < 0 || msgLevel > levelMap.length) {
|
||||
msgLevel = 2;
|
||||
}
|
||||
logger.log(levelMap[msgLevel], msg);
|
||||
}
|
||||
|
||||
public void flushToFile(File file){
|
||||
|
||||
}
|
||||
}
|
@@ -1,91 +1,100 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
EdkLogger.java
|
||||
Module Name:
|
||||
EdkLogger.java
|
||||
|
||||
Abstract:
|
||||
|
||||
--*/
|
||||
Abstract:
|
||||
|
||||
--*/
|
||||
package org.tianocore.common.logger;
|
||||
|
||||
import org.tianocore.common.logger.LogMethod;
|
||||
import java.io.File;
|
||||
|
||||
public class EdkLog {
|
||||
private static final String error = "ERROR";
|
||||
private static final String warning = "WARNING";
|
||||
private static final String info = "INFO";
|
||||
private static final String verbose = "VERBOSE";
|
||||
private static final String debug = "DEBUG";
|
||||
public static final String always = "ALWAYS";
|
||||
|
||||
public static final String error = "ERROR";
|
||||
|
||||
public static final String warning = "WARNING";
|
||||
|
||||
public static final String info = "INFO";
|
||||
|
||||
public static final String verbose = "VERBOSE";
|
||||
|
||||
public static final String debug = "DEBUG";
|
||||
|
||||
public static final int EDK_ALWAYS = -1;
|
||||
|
||||
public static final int EDK_ERROR = 0;
|
||||
|
||||
public static final int EDK_ERROR = 0;
|
||||
public static final int EDK_WARNING = 1;
|
||||
public static final int EDK_INFO = 2;
|
||||
|
||||
public static final int EDK_INFO = 2;
|
||||
|
||||
public static final int EDK_VERBOSE = 3;
|
||||
public static final int EDK_DEBUG = 4;
|
||||
|
||||
public static final int EDK_DEBUG = 4;
|
||||
|
||||
private static int logLevel = EDK_INFO;
|
||||
|
||||
private static LogMethod logger = new DefaultLogger();
|
||||
|
||||
public static void log(int level, String message) {
|
||||
if (level <= logLevel){
|
||||
logger.putMessage(null, logLevel, message);
|
||||
if (level <= logLevel) {
|
||||
logger.putMessage(null, level, message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void log(int logLevel, String message, Exception cause) {
|
||||
|
||||
public static void log(String message) {
|
||||
if (EDK_INFO <= logLevel) {
|
||||
logger.putMessage(null, EDK_INFO, message);
|
||||
}
|
||||
}
|
||||
|
||||
public static void log(int logLevel, Exception cause) {
|
||||
|
||||
}
|
||||
|
||||
public static void log(Exception cause) {
|
||||
|
||||
public static void flushLogToFile(File file) {
|
||||
logger.flushToFile(file);
|
||||
}
|
||||
|
||||
public static void setLogger(LogMethod l) {
|
||||
logger = l;
|
||||
}
|
||||
|
||||
public static void setLogLevel (int level){
|
||||
public static void setLogLevel(int level) {
|
||||
logLevel = level;
|
||||
}
|
||||
public static void setLogLevel (String level){
|
||||
if (level == null){
|
||||
return;
|
||||
}
|
||||
String levelStr = level.trim();
|
||||
if (levelStr.equalsIgnoreCase(error)){
|
||||
logLevel = EDK_ERROR;
|
||||
}
|
||||
if (levelStr.equalsIgnoreCase(debug)){
|
||||
logLevel = EDK_DEBUG;
|
||||
}
|
||||
if (levelStr.equalsIgnoreCase(info)){
|
||||
logLevel = EDK_INFO;
|
||||
}
|
||||
if (levelStr.equalsIgnoreCase(verbose)){
|
||||
logLevel = EDK_VERBOSE;
|
||||
}
|
||||
if (levelStr.equalsIgnoreCase(warning)){
|
||||
logLevel = EDK_WARNING;
|
||||
}
|
||||
|
||||
public static void setLogLevel(String level) {
|
||||
if (level == null) {
|
||||
return;
|
||||
}
|
||||
String levelStr = level.trim();
|
||||
if (levelStr.equalsIgnoreCase(error)) {
|
||||
logLevel = EDK_ERROR;
|
||||
}
|
||||
if (levelStr.equalsIgnoreCase(debug)) {
|
||||
logLevel = EDK_DEBUG;
|
||||
}
|
||||
if (levelStr.equalsIgnoreCase(info)) {
|
||||
logLevel = EDK_INFO;
|
||||
}
|
||||
if (levelStr.equalsIgnoreCase(verbose)) {
|
||||
logLevel = EDK_VERBOSE;
|
||||
}
|
||||
if (levelStr.equalsIgnoreCase(warning)) {
|
||||
logLevel = EDK_WARNING;
|
||||
}
|
||||
}
|
||||
public static int getLogLevel (){
|
||||
|
||||
public static int getLogLevel() {
|
||||
return logLevel;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1,23 +1,27 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
LogMethod.java
|
||||
Module Name:
|
||||
LogMethod.java
|
||||
|
||||
Abstract:
|
||||
Abstract:
|
||||
|
||||
--*/
|
||||
--*/
|
||||
|
||||
package org.tianocore.common.logger;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public interface LogMethod {
|
||||
public void putMessage(Object msgSource, int msgLevel, String msg);
|
||||
|
||||
public void flushToFile(File file);
|
||||
}
|
||||
|
Reference in New Issue
Block a user