]> git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/Common/org/tianocore/common/logger/EdkLog.java
moved exception and logger classes to org.tianocore.common package; and created defin...
[mirror_edk2.git] / Tools / Source / Common / org / tianocore / common / logger / EdkLog.java
1 /*++
2
3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 Module Name:
13 EdkLogger.java
14
15 Abstract:
16
17 --*/
18 package org.tianocore.logger;
19
20 import org.tianocore.logger.LogMethod;
21
22
23 public class EdkLog {
24 private static final String error = "ERROR";
25 private static final String warning = "WARNING";
26 private static final String info = "INFO";
27 private static final String verbose = "VERBOSE";
28 private static final String debug = "DEBUG";
29
30 public static final int EDK_ERROR = 0;
31 public static final int EDK_WARNING = 1;
32 public static final int EDK_INFO = 2;
33 public static final int EDK_VERBOSE = 3;
34 public static final int EDK_DEBUG = 4;
35
36 private static int logLevel = EDK_INFO;
37 private static LogMethod logger = new DefaultLogger();
38
39 public static void log(int level, String message) {
40 if (level <= logLevel){
41 logger.putMessage(null, logLevel, message);
42 }
43
44 }
45
46 public static void log(int logLevel, String message, Exception cause) {
47
48 }
49
50 public static void log(int logLevel, Exception cause) {
51
52 }
53
54 public static void log(Exception cause) {
55
56 }
57
58 public static void setLogger(LogMethod l) {
59 logger = l;
60 }
61
62 public static void setLogLevel (int level){
63 logLevel = level;
64 }
65 public static void setLogLevel (String level){
66 if (level == null){
67 return;
68 }
69 String levelStr = level.trim();
70 if (levelStr.equalsIgnoreCase(error)){
71 logLevel = EDK_ERROR;
72 }
73 if (levelStr.equalsIgnoreCase(debug)){
74 logLevel = EDK_DEBUG;
75 }
76 if (levelStr.equalsIgnoreCase(info)){
77 logLevel = EDK_INFO;
78 }
79 if (levelStr.equalsIgnoreCase(verbose)){
80 logLevel = EDK_VERBOSE;
81 }
82 if (levelStr.equalsIgnoreCase(warning)){
83 logLevel = EDK_WARNING;
84 }
85 }
86 public static int getLogLevel (){
87 return logLevel;
88 }
89 }
90
91