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