Remove unused PCD file.
[mirror_edk2.git] / Tools / Source / GenBuild / org / tianocore / build / pcd / action / ActionMessage.java
1 /** @file
2 ActionMessage class.
3
4 ActionMessage class take over all message for loging and waning. This class should
5 dispatch message into different class according to instance class type.
6
7 Copyright (c) 2006, Intel Corporation
8 All rights reserved. This program and the accompanying materials
9 are licensed and made available under the terms and conditions of the BSD License
10 which accompanies this distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php
12
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15
16 **/
17 package org.tianocore.build.pcd.action;
18
19 import org.apache.tools.ant.Task;
20 import org.tianocore.build.pcd.action.BuildAction;
21
22 /** ActionMessage class take over all message for loging and waning. This class
23 should dispatch message into different Action class according to instance
24 class type.
25 **/
26 public class ActionMessage {
27 ///
28 /// Macro definition for NULL messge level.
29 /// In this meessage level, all message will be hidden.
30 ///
31 public final static int NULL_MESSAGE_LEVEL = 0;
32 ///
33 /// Macro definition for Log messge level.
34 /// In this message level, Only log information will be shown.
35 ///
36 public final static int LOG_MESSAGE_LEVEL = 1;
37 ///
38 /// Macro definition for Warning message level.
39 /// In this message level, log and waning message will be shown.
40 ///
41 public final static int WARNING_MESSAGE_LEVEL = 2;
42 ///
43 /// Macro definition for Debug mesage level.
44 /// In this message level, log, warning, debug message will be shown.
45 ///
46 public final static int DEBUG_MESSAGE_LEVEL = 3;
47 ///
48 /// Macor definition for MAX message level.
49 /// In this message level, all message will be shown.
50 ///
51 public final static int MAX_MESSAGE_LEVEL = 4;
52 ///
53 /// Current message level. It will control all message output for PCD tool.
54 ///
55 public static int messageLevel = NULL_MESSAGE_LEVEL;
56
57 /**
58 Log() function provide common log information functionality for all
59 PCD tool includes all function
60
61 This function will dispatch message to special class such as BuildAction
62 Class, Entity Class etc.
63
64 @param thisClass The class object who want log information.
65 @param logStr The string contains log information.
66 **/
67 public static void log(Object thisClass, String logStr) {
68 if(messageLevel < LOG_MESSAGE_LEVEL) {
69 return;
70 }
71
72 if(thisClass instanceof Task) {
73 BuildAction.logMsg(thisClass, "$$LOG$$:" + logStr);
74 } else {
75 System.out.println("$$LOG$$:" + logStr);
76 }
77 }
78
79 /**
80 Warning() function provide common warning information functionality for all
81 PCD tool.
82
83 This function will dispatch message to special class such as BuildAction
84 Class, Entity Class etc.
85
86 @param thisClass The class object who want warn information.
87 @param warningStr The string contains warning information.
88 **/
89 public static void warning(Object thisClass, String warningStr) {
90 if(messageLevel < WARNING_MESSAGE_LEVEL) {
91 return;
92 }
93
94 if(thisClass instanceof Task) {
95 BuildAction.warningMsg(thisClass, "**WARNING**:" + warningStr);
96 } else {
97 System.out.println("**WARNING**:" + warningStr);
98 }
99 }
100
101 /**
102 Debug() function provide common Debug information functionality for all
103 PCD tool.
104
105 This function will dispatch message to special class such as BuildAction
106 Class, Entity Class etc.
107
108 @param thisClass The class object who want Debug information.
109 @param debugStr The string contains Debug information.
110 **/
111 public static void debug(Object thisClass, String debugStr) {
112 if(messageLevel < DEBUG_MESSAGE_LEVEL) {
113 return;
114 }
115
116 if(thisClass instanceof Task) {
117 BuildAction.logMsg(thisClass, "%%DEBUG%%:" + debugStr);
118 } else {
119 System.out.println("%%DEBUG%%:" + debugStr);
120 }
121 }
122 }