(file) Return to Logger.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2