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