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