1 karl 1.18 //%2004////////////////////////////////////////////////////////////////////////
|
2 mike 1.8 //
|
3 karl 1.18 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
4 // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
5 // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
|
6 karl 1.17 // IBM Corp.; EMC Corporation, The Open Group.
|
7 karl 1.18 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
8 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
|
9 mike 1.8 //
10 // Permission is hereby granted, free of charge, to any person obtaining a copy
|
11 kumpf 1.10 // of this software and associated documentation files (the "Software"), to
12 // deal in the Software without restriction, including without limitation the
13 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
14 mike 1.8 // sell copies of the Software, and to permit persons to whom the Software is
15 // furnished to do so, subject to the following conditions:
16 //
|
17 kumpf 1.10 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
|
18 mike 1.8 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
19 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
20 kumpf 1.10 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
21 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
23 mike 1.8 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 //
26 //==============================================================================
27 //
28 // Author: Mike Brasher (mbrasher@bmc.com)
29 //
|
30 david 1.12 // Modified By: Dave Rosckes (rosckes@us.ibm.com)
|
31 mike 1.8 //
32 //%/////////////////////////////////////////////////////////////////////////////
33
34 #ifndef Pegasus_Logger_h
35 #define Pegasus_Logger_h
36
37 #include <Pegasus/Common/Config.h>
38 #include <Pegasus/Common/Formatter.h>
|
39 kumpf 1.11 #include <Pegasus/Common/Linkage.h>
|
40 david 1.14 #include <Pegasus/Common/System.h>
|
41 chuck 1.15 #include <Pegasus/Common/MessageLoader.h> // l10n
|
42 mike 1.8
43 PEGASUS_NAMESPACE_BEGIN
44
45 class LoggerRep;
46
|
47 mike 1.9 // REVIEW: is this still used? Are there other mechanisms?
48
|
49 mike 1.8 /**
50
51 */
|
52 david 1.12
|
53 mike 1.8 class PEGASUS_COMMON_LINKAGE Logger
54 {
55 public:
56
57 enum LogFileType
58 {
59 TRACE_LOG,
60 STANDARD_LOG,
61 ERROR_LOG,
62 DEBUG_LOG
63 };
64 enum { NUM_LOGS = 4 };
65
|
66 david 1.12 /** Log file Level - Defines the loglevel of the
|
67 mike 1.8 log entry irrespective of which log file it goes into. This is
68 actually a bit mask as defined in logger.cpp. Thus, it serves both
69 as a level of indication of the seriousness and possibly as a mask
70 to select what is logged.
71 ATTN: The selection test has not been done.
72 */
73
74 static const Uint32 TRACE;
75 static const Uint32 INFORMATION;
76 static const Uint32 WARNING;
77 static const Uint32 SEVERE;
78 static const Uint32 FATAL;
79
|
80 david 1.12
|
81 mike 1.8 /** put - Puts a message to the defined log file
82 @param logFileType - Type of log file (Trace, etc.)
83 @param systemId - ID of the system generating the log entry within
84 Pegasus. This is user defined but generally breaks down into major
85 Pegasus components.
|
86 david 1.12 @param level logLevel of the log entry. To be used both t0
|
87 mike 1.8 mark the log entry and tested against a mask to determine if log
88 entry should be written.
89 @param formatString Format definition string for the Log. See the
90 Formatter for details.
91 @param Arg0 - Arg 9 - Up to 9 arguments representing the variables
92 that go into the log entry.
93 <pre>
94 Logger::put(Logger::TRACE_LOG, "CIMServer", Logger::WARNING,
95 "X=$0, Y=$1, Z=$2", 88, "Hello World", 7.5);
96 </pre>
97 */
98 static void put(
|
99 david 1.12 LogFileType logFileType,
100 const String& systemId,
101 Uint32 logLevel,
102 const String& formatString,
103 const Formatter::Arg& arg0 = Formatter::Arg(),
104 const Formatter::Arg& arg1 = Formatter::Arg(),
105 const Formatter::Arg& arg2 = Formatter::Arg(),
106 const Formatter::Arg& arg3 = Formatter::Arg(),
107 const Formatter::Arg& arg4 = Formatter::Arg(),
108 const Formatter::Arg& arg5 = Formatter::Arg(),
109 const Formatter::Arg& arg6 = Formatter::Arg(),
110 const Formatter::Arg& arg7 = Formatter::Arg(),
111 const Formatter::Arg& arg8 = Formatter::Arg(),
112 const Formatter::Arg& arg9 = Formatter::Arg());
113
|
114 chuck 1.15 // l10n
|
115 chuck 1.16 #ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES
|
116 chuck 1.15 /** put_l - Puts a localized message to the defined log file
117 @param logFileType - Type of log file (Trace, etc.)
118 @param systemId - ID of the system generating the log entry within
119 Pegasus. This is user defined but generally breaks down into major
120 Pegasus components.
121 @param level logLevel of the log entry. To be used both t0
122 mark the log entry and tested against a mask to determine if log
123 entry should be written.
124 @param messageId Message ID of the format string to load from
125 the resource bundle.
126 @param formatString Default format definition string. See the
127 Formatter for details. This will be used as the default format string
128 in case the resource bundle cannot be found.
129 @param Arg0 - Arg 9 - Up to 9 arguments representing the variables
130 that go into the log entry.
131 <pre>
132 Logger::put(Logger::TRACE_LOG, "CIMServer", Logger::WARNING,
133 "X=$0, Y=$1, Z=$2", 88, "Hello World", 7.5);
134 </pre>
135 */
136 static void put_l(
137 chuck 1.15 LogFileType logFileType,
138 const String& systemId,
139 Uint32 logLevel,
|
140 chuck 1.16 const String& messageId,
|
141 chuck 1.15 const String& formatString,
142 const Formatter::Arg& arg0 = Formatter::Arg(),
143 const Formatter::Arg& arg1 = Formatter::Arg(),
144 const Formatter::Arg& arg2 = Formatter::Arg(),
145 const Formatter::Arg& arg3 = Formatter::Arg(),
146 const Formatter::Arg& arg4 = Formatter::Arg(),
147 const Formatter::Arg& arg5 = Formatter::Arg(),
148 const Formatter::Arg& arg6 = Formatter::Arg(),
149 const Formatter::Arg& arg7 = Formatter::Arg(),
150 const Formatter::Arg& arg8 = Formatter::Arg(),
151 const Formatter::Arg& arg9 = Formatter::Arg());
|
152 chuck 1.16 #endif
|
153 chuck 1.15
154
|
155 david 1.12 // _trace - puts a message to the define log. Should only be used
156 // for trace type logs
157 static void trace(
158 LogFileType logFileType,
159 const String& systemId,
160 const Uint32 logComponent,
161 const String& formatString,
162 const Formatter::Arg& arg0 = Formatter::Arg(),
163 const Formatter::Arg& arg1 = Formatter::Arg(),
164 const Formatter::Arg& arg2 = Formatter::Arg(),
165 const Formatter::Arg& arg3 = Formatter::Arg(),
166 const Formatter::Arg& arg4 = Formatter::Arg(),
167 const Formatter::Arg& arg5 = Formatter::Arg(),
168 const Formatter::Arg& arg6 = Formatter::Arg(),
169 const Formatter::Arg& arg7 = Formatter::Arg(),
170 const Formatter::Arg& arg8 = Formatter::Arg(),
171 const Formatter::Arg& arg9 = Formatter::Arg());
|
172 mike 1.8
|
173 chuck 1.15
174 // l10n
|
175 chuck 1.16 #ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES
|
176 chuck 1.15 // trace - puts a localized message to the log. Should only be used
177 // for trace type logs
178 static void trace_l(
179 LogFileType logFileType,
180 const String& systemId,
181 const Uint32 logComponent,
|
182 chuck 1.16 const String& messageId,
|
183 chuck 1.15 const String& formatString,
184 const Formatter::Arg& arg0 = Formatter::Arg(),
185 const Formatter::Arg& arg1 = Formatter::Arg(),
186 const Formatter::Arg& arg2 = Formatter::Arg(),
187 const Formatter::Arg& arg3 = Formatter::Arg(),
188 const Formatter::Arg& arg4 = Formatter::Arg(),
189 const Formatter::Arg& arg5 = Formatter::Arg(),
190 const Formatter::Arg& arg6 = Formatter::Arg(),
191 const Formatter::Arg& arg7 = Formatter::Arg(),
192 const Formatter::Arg& arg8 = Formatter::Arg(),
193 const Formatter::Arg& arg9 = Formatter::Arg());
|
194 chuck 1.16 #endif
|
195 chuck 1.15
196
|
197 mike 1.8 /** setHomeDirectory
198 */
199 static void setHomeDirectory(const String& homeDirectory);
200
|
201 david 1.12 /** setlogLevelMask
|
202 mike 1.8 */
|
203 david 1.12 static void setlogLevelMask(const String logLevelList);
|
204 mike 1.8
205 /** setLogWriteControlMask
206 */
207 static void setLogWriteControlMask(const Uint32);
208
|
209 david 1.12 static Boolean isValidlogLevel(const String logLevel);
|
210 mike 1.8 private:
211
|
212 david 1.12
|
213 mike 1.8 static LoggerRep* _rep;
214 static String _homeDirectory;
215 static Uint32 _severityMask;
216 static Uint32 _writeControlMask;
|
217 david 1.12
218 static const char _SEPARATOR;
219 static const Uint32 _NUM_LOGLEVEL;
220
221 static const Boolean _SUCCESS;
222 static const Boolean _FAILURE;
223 static void _putInternal(
224 LogFileType logFileType,
225 const String& systemId,
226 const Uint32 logComponent,
227 Uint32 logLevel,
228 const String& formatString,
|
229 chuck 1.16 const String& messageId, // l10n
|
230 david 1.12 const Formatter::Arg& arg0 = Formatter::Arg(),
231 const Formatter::Arg& arg1 = Formatter::Arg(),
232 const Formatter::Arg& arg2 = Formatter::Arg(),
233 const Formatter::Arg& arg3 = Formatter::Arg(),
234 const Formatter::Arg& arg4 = Formatter::Arg(),
235 const Formatter::Arg& arg5 = Formatter::Arg(),
236 const Formatter::Arg& arg6 = Formatter::Arg(),
237 const Formatter::Arg& arg7 = Formatter::Arg(),
238 const Formatter::Arg& arg8 = Formatter::Arg(),
239 const Formatter::Arg& arg9 = Formatter::Arg());
240
|
241 mike 1.8 };
242
243 PEGASUS_NAMESPACE_END
244
245 #endif /* Pegasus_Logger_h */
|