]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/STEERBase/AliLog.h
- introduction of gain scenarios (e.g. OROC only - for homogeneous gain in 11h)
[u/mrichter/AliRoot.git] / STEER / STEERBase / AliLog.h
1 #ifndef ALILOG_H
2 #define ALILOG_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 /* $Id$ */
7
8 #include <TClass.h>
9 #include <TObjArray.h>
10 #include <TObject.h>
11 #include <TString.h>
12
13 using std::ostream;
14
15 // deprecation macro
16 #if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
17 # define ALIROOT_DEPRECATED(func) func  __attribute__ ((deprecated))
18 #elif defined(_MSC_VER) && _MSC_VER >= 1300
19 # define ALIROOT_DEPRECATED(func) __declspec(deprecated) func
20 #else
21 # define ALIROOT_DEPRECATED(func) func
22 #endif
23
24 /**
25  * class for logging debug, info and error messages
26  */
27 class AliLog: public TObject
28 {
29  public:
30
31                 // Log4j log levels: TRACE, DEBUG, INFO, WARN, ERROR, FATAL
32   enum EType_t {kFatal = 0, kError, kWarning, kInfo, kDebug, kMaxType};
33   typedef void (*AliLogNotification)(EType_t type, const char* message );
34
35                 // NB: singleton constructor & destructor should not be public!
36                 // ALIROOT_DEPRECATED(AliLog());
37                 // ALIROOT_DEPRECATED(virtual ~AliLog());
38
39                 // NB: singleton deprecated static instance method
40                 // ALIROOT_DEPRECATED(static AliLog* Instance() {return fgInstance;};)
41
42                 // get root logger singleton instance
43                 static AliLog *GetRootLogger();
44
45                 // delete root logger singleton instance
46                 static void DeleteRootLogger();
47
48                 // NB: the following functions should not be static
49                 // NB: deprecated: logging configuration should be made through to a configuration file
50   static void  EnableDebug(Bool_t enabled);
51   static void  SetGlobalLogLevel(EType_t type);
52   static Int_t GetGlobalLogLevel();
53   static void  SetGlobalDebugLevel(Int_t level);
54   static Int_t GetGlobalDebugLevel();
55   static void  SetModuleDebugLevel(const char* module, Int_t level);
56   static void  ClearModuleDebugLevel(const char* module);
57   static void  SetClassDebugLevel(const char* className, Int_t level);
58   static void  ClearClassDebugLevel(const char* className);
59
60   static void  SetStandardOutput();
61   static void  SetStandardOutput(EType_t type);
62   static void  SetErrorOutput();
63   static void  SetErrorOutput(EType_t type);
64   static void  SetFileOutput(const char* fileName);
65   static void  SetFileOutput(EType_t type, const char* fileName);
66   static void  SetStreamOutput(ostream* stream);
67   static void  SetStreamOutput(EType_t type, ostream* stream);
68   static void  SetLogNotification(AliLogNotification pCallBack);
69   static void  SetLogNotification(EType_t type, AliLogNotification pCallBack);
70   static void  Flush();
71
72   static void  SetHandleRootMessages(Bool_t on);
73
74   static void  SetPrintType(Bool_t on);
75   static void  SetPrintType(EType_t type, Bool_t on);
76   static void  SetPrintModule(Bool_t on);
77   static void  SetPrintModule(EType_t type, Bool_t on);
78   static void  SetPrintScope(Bool_t on);
79   static void  SetPrintScope(EType_t type, Bool_t on);
80   static void  SetPrintLocation(Bool_t on);
81   static void  SetPrintLocation(EType_t type, Bool_t on);
82
83   static void  SetPrintRepetitions(Bool_t on);
84
85   static void  WriteToFile(const char* name, Int_t option = 0);
86
87   // the following public methods are used by the preprocessor macros 
88   // and should not be called directly
89   static Bool_t IsDebugEnabled() {return fgDebugEnabled;}
90   static Int_t GetDebugLevel(const char* module, const char* className);
91   static void  Message(UInt_t level, const char* message, 
92                        const char* module, const char* className,
93                        const char* function, const char* file, Int_t line);
94   static void  Debug(UInt_t level, const char* message, 
95                      const char* module, const char* className,
96                      const char* function, const char* file, Int_t line);
97
98   static Int_t RedirectStdoutTo(EType_t type, UInt_t level, const char* module, 
99                                 const char* className, const char* function,
100                                 const char* file, Int_t line, Bool_t print);
101   static Int_t RedirectStderrTo(EType_t type, UInt_t level, const char* module, 
102                                 const char* className, const char* function,
103                                 const char* file, Int_t line, Bool_t print);
104   static void  RestoreStdout(Int_t original);
105   static void  RestoreStderr(Int_t original);
106
107   static ostream& Stream(EType_t type, UInt_t level,
108                          const char* module, const char* className,
109                          const char* function, const char* file, Int_t line);
110
111  private:
112
113                 // constructor is made private for implementing a singleton
114                 AliLog();
115                 virtual ~AliLog();
116
117                 // NOT IMPLEMENTED?
118   AliLog(const AliLog& log);
119   AliLog& operator = (const AliLog& log);
120
121   void           ReadEnvSettings();
122
123   static void    RootErrorHandler(Int_t level, Bool_t abort, 
124                                   const char* location, const char* message);
125
126   void           CloseFile(Int_t type);
127   FILE*          GetOutputStream(Int_t type);
128
129   UInt_t         GetLogLevel(const char* module, const char* className) const;
130   void           PrintMessage(UInt_t type, const char* message, 
131                               const char* module, const char* className,
132                               const char* function, 
133                               const char* file, Int_t line);
134
135   void           PrintString(Int_t type, FILE* stream, const char* format, ...);
136   void           PrintRepetitions();
137
138   Int_t          RedirectTo(FILE* stream, EType_t type, UInt_t level,
139                             const char* module, const char* className,
140                             const char* function,
141                             const char* file, Int_t line, Bool_t print);
142
143   ostream&       GetStream(EType_t type, UInt_t level,
144                            const char* module, const char* className,
145                            const char* function, const char* file, Int_t line);
146
147   enum {kDebugOffset = kDebug-1};
148
149   static AliLog* fgInstance;                 //! pointer to current instance
150   static Bool_t  fgDebugEnabled;             // flag for debug en-/disabling
151
152   UInt_t         fGlobalLogLevel;            // global logging level
153   TObjArray      fModuleDebugLevels;         // debug levels for modules
154   TObjArray      fClassDebugLevels;          // debug levels for classes
155
156   Int_t          fOutputTypes[kMaxType];     // types of output streams
157   TString        fFileNames[kMaxType];       // file names
158   FILE*          fOutputFiles[kMaxType];     //! log output files
159   ostream*       fOutputStreams[kMaxType];   //! log output streams
160
161   Bool_t         fPrintType[kMaxType];       // print type on/off
162   Bool_t         fPrintModule[kMaxType];     // print module on/off
163   Bool_t         fPrintScope[kMaxType];      // print scope/class name on/off
164   Bool_t         fPrintLocation[kMaxType];   // print file and line on/off
165
166   Bool_t         fPrintRepetitions;          // print number of repetitions instead of repeated message on/off
167
168   Int_t          fRepetitions;               //! counter of repetitions
169   UInt_t         fLastType;                  //! type of last message
170   TString        fLastMessage;               //! last message
171   TString        fLastModule;                //! module name of last message
172   TString        fLastClassName;             //! class name of last message
173   TString        fLastFunction;              //! function name of last message
174   TString        fLastFile;                  //! file name of last message
175   Int_t          fLastLine;                  //! line number of last message
176   AliLogNotification fCallBacks[kMaxType];   //! external notification callback
177
178   ClassDef(AliLog, 1)   // class for logging debug, info and error messages
179 };
180
181
182 // module name macro
183 #ifdef _MODULE_
184 # define MODULENAME() _MODULE_
185 #else
186 # define MODULENAME() "NoModule"
187 #endif
188
189 // function name macro
190 #if defined(__GNUC__) || defined(__ICC) || defined(__ECC) || defined(__APPLE__)
191 # define FUNCTIONNAME() __FUNCTION__
192 // #elif defined(__HP_aCC) || defined(__alpha) || defined(__DECCXX)
193 // #define FUNCTIONNAME() __FUNC__
194 #else
195 # define FUNCTIONNAME() "???"
196 #endif
197
198 // redirection
199 /** 
200  * Redirect output to std::cout to specified log stream 
201  * 
202  * @param type      Type of stream to re-direct to
203  * @param level     Level of output
204  * @param scope     Scope
205  * @param whatever  Any code that will output to std::cout 
206  */
207 #define REDIRECTSTDOUT(type, level, scope, whatever) \
208   do {Int_t originalStdout = AliLog::RedirectStdoutTo(type, level, MODULENAME(), scope, FUNCTIONNAME(), __FILE__, __LINE__, kFALSE); \
209     whatever; AliLog::RestoreStdout(originalStdout);} while(false)
210 /** 
211  * Redirect output to std::cerr to specified log stream 
212  * 
213  * @param type      Type of stream to re-direct to
214  * @param level     Level of output
215  * @param scope     Scope
216  * @param whatever  Any code that will output to std::cout 
217  */
218 #define REDIRECTSTDERR(type, level, scope, whatever) \
219   do {Int_t originalStderr = AliLog::RedirectStderrTo(type, level, MODULENAME(), scope, FUNCTIONNAME(), __FILE__, __LINE__, kFALSE); \
220     whatever; AliLog::RestoreStderr(originalStderr);} while(false)
221 /** 
222  * Redirect output to std::cout and std::cerr to specified log stream 
223  * 
224  * @param type      Type of stream to re-direct to
225  * @param level     Level of output
226  * @param scope     Scope
227  * @param whatever  Any code that will output to std::cout or std::cerr
228  */
229 #define REDIRECTSTDOUTANDSTDERR(type, level, scope, whatever) \
230   do {Int_t originalStdout = AliLog::RedirectStdoutTo(type, level, MODULENAME(), scope, FUNCTIONNAME(), __FILE__, __LINE__, kFALSE); \
231     Int_t originalStderr = AliLog::RedirectStderrTo(type, level, MODULENAME(), scope, FUNCTIONNAME(), __FILE__, __LINE__, kFALSE); \
232     whatever; AliLog::RestoreStderr(originalStderr); AliLog::RestoreStdout(originalStdout);} while(false)
233
234
235 // debug level
236 #ifdef LOG_NO_DEBUG
237 # define AliDebugLevel() -1
238 # define AliDebugLevelClass() -1
239 # define AliDebugLevelGeneral(scope) -1
240 #else
241 /** 
242  * Get the object scope debug level
243  */
244 # define AliDebugLevel() ((AliLog::IsDebugEnabled()) ? AliLog::GetDebugLevel(MODULENAME(), ClassName()) : -1)
245 /** 
246  * Get the class (ROOT-enabled) debug level
247  */
248 # define AliDebugLevelClass() ((AliLog::IsDebugEnabled()) ? AliLog::GetDebugLevel(MODULENAME(), Class()->GetName()) : -1)
249 /**
250  * Get the debug level associated with scope 
251  * @param scope Scope 
252  */
253 # define AliDebugLevelGeneral(scope) ((AliLog::IsDebugEnabled()) ? AliLog::GetDebugLevel(MODULENAME(), scope) : -1)
254 #endif
255
256 // debug messages
257 #ifdef LOG_NO_DEBUG
258 # define AliDebug(level, message) do { } while (false)
259 # define AliDebugClass(level, message) do { } while (false)
260 # define AliDebugGeneral(scope, level, message) do { } while (false)
261 # define AliDebugF(level, message,...) do { } while (false)
262 # define AliDebugClassF(level, message,...) do { } while (false)
263 # define AliDebugGeneralF(scope, level, message,...) do { } while (false)
264 #else
265
266 // inspired by log4cxx code (see log4cxx/Logger.h)
267 // implements GCC branch prediction for increasing logging performance
268 # if !defined(ALIROOT_UNLIKELY)
269 #  if defined(__GNUC__) && (__GNUC__ >= 3)
270 /**
271  * Provides optimization hint to the compiler
272  * to optimize for the expression being false.
273  * @param expr boolean expression.
274  * @returns value of expression.
275  */
276 #   define ALIROOT_UNLIKELY(expr) __builtin_expect(expr, 0)
277 #  else
278 /**
279  * Provides optimization hint to the compiler
280  * to optimize for the expression being false.
281  * @param expr boolean expression.
282  * @returns value of expression.
283  */
284 #   define ALIROOT_UNLIKELY(expr) expr
285 #  endif
286 # endif 
287
288 /**
289  * 
290  * Logs a message to a specified logger with the DEBUG level.
291  * 
292  * @param logLevel the debug level.
293  * @param message message to print in the following format: Form(message).
294  * Note, that message should contain balanced parenthesis, like 
295  * <code>AliDebug(1, Form("Failed to decode line %d of %s", line, filename));</code> 
296  */
297 # define AliDebug(logLevel, message) \
298         do { if (ALIROOT_UNLIKELY(AliLog::IsDebugEnabled() && AliLog::GetDebugLevel(MODULENAME(), ClassName()) >= logLevel)) {\
299           AliLog::Debug(logLevel, message, MODULENAME(), ClassName(), FUNCTIONNAME(), __FILE__, __LINE__); }} while (0)
300 /**
301  * 
302  * Logs a message to a specified logger with the DEBUG level.  For use
303  * in static member functions of a class 
304  * 
305  * @param logLevel the debug level.
306  * @param message message to print in the following format: Form(message).
307  * Note, that message should contain balanced parenthesis, like 
308  * <code>AliDebug(1, Form("Failed to decode line %d of %s", line, filename));</code> 
309  */
310 # define AliDebugClass(logLevel, message) \
311         do { if (ALIROOT_UNLIKELY(AliLog::IsDebugEnabled() && AliLog::GetDebugLevel(MODULENAME(), Class()->GetName()) >= logLevel)) {\
312           AliLog::Debug(logLevel, message, MODULENAME(), Class()->GetName(), FUNCTIONNAME(), __FILE__, __LINE__); }} while (0)
313
314 /**
315  * Logs a message to a specified logger with the DEBUG level.  For use
316  * in non-ROOT-enabled-class scope.
317  * 
318  * @param scope the logging scope.
319  * @param logLevel the debug level.
320  * @param message message to print in the following format: Form(message).
321  * Note, that message should contain balanced parenthesis, like 
322  * <code>AliDebug(1, Form("Failed to decode line %d of %s", line, filename));</code> 
323 */
324 # define AliDebugGeneral(scope, logLevel, message) \
325         do { if (ALIROOT_UNLIKELY(AliLog::IsDebugEnabled() && AliLog::GetDebugLevel(MODULENAME(), scope) >= logLevel)) {\
326           AliLog::Debug(logLevel, message, MODULENAME(), scope, FUNCTIONNAME(), __FILE__, __LINE__); }} while (0)
327 /** 
328  * Macro to output debugging information.  This excepts a printf-like
329  * format statement.   Note, at least 3 arguments (in total) must be
330  * passed. 
331  * 
332  * @param logLevel Debug level
333  * @param format   Printf-like format. 
334  */
335 # define AliDebugF(logLevel,format,...) \
336 do { if (ALIROOT_UNLIKELY(AliLog::IsDebugEnabled() && AliLog::GetDebugLevel(MODULENAME(), ClassName()) >= logLevel)) { \
337     TString m;m.Form(format,__VA_ARGS__);                                       \
338     AliLog::Debug(logLevel, m, MODULENAME(), ClassName(), FUNCTIONNAME(), __FILE__, __LINE__); }} while (0)
339 /** 
340  * Outut debug information, filtered on debug level.  For use in
341  * static member function of a ROOT-enabled class. This excepts a
342  * printf-like format statement.  Note, at least 3 arguments (in
343  * total) must be passed.
344  * 
345  * @param logLevel Debug level
346  * @param format   Printf-like format 
347  * 
348  * @return 
349  */
350 # define AliDebugClassF(logLevel,format,...) \
351   do { if (ALIROOT_UNLIKELY(AliLog::IsDebugEnabled() && AliLog::GetDebugLevel(MODULENAME(), Class()->GetName()) >= logLevel)) { \
352       TString m;m.Form(format,__VA_ARGS__);                                     \
353       AliLog::Debug(logLevel, m, MODULENAME(), Class()->GetName(), FUNCTIONNAME(), __FILE__, __LINE__); }} while (0)
354 /** 
355  * Outut debug information, filtered on debug level.  For use in
356  * static member function of a non-ROOT-enabled class-scope. This
357  * excepts a printf-like format statement.  Note, at least 3 arguments
358  * (in total) must be passed.
359  * 
360  * @param scope    Scope 
361  * @param logLevel Debug level
362  * @param format   Printf-like format 
363  * 
364  * @return 
365  */
366 # define AliDebugGeneralF(scope,logLevel,format,...) \
367   do { if (ALIROOT_UNLIKELY(AliLog::IsDebugEnabled() && AliLog::GetDebugLevel(MODULENAME(), scope) >= logLevel)) { \
368       TString m;m.Form(format,__VA_ARGS__);                                     \
369       AliLog::Debug(logLevel, m, MODULENAME(), scope, FUNCTIONNAME(), __FILE__, __LINE__); }} while (0)
370     
371 #endif
372
373 // redirection to debug
374 #define StdoutToAliDebug(level, whatever) REDIRECTSTDOUT(AliLog::kDebug, level, ClassName(), whatever)
375 #define StderrToAliDebug(level, whatever) REDIRECTSTDERR(AliLog::kDebug, level, ClassName(), whatever)
376 #define ToAliDebug(level, whatever) REDIRECTSTDOUTANDSTDERR(AliLog::kDebug, level, ClassName(), whatever)
377 #define StdoutToAliDebugClass(level, whatever) REDIRECTSTDOUT(AliLog::kDebug, level, Class()->GetName(), whatever)
378 #define StderrToAliDebugClass(level, whatever) REDIRECTSTDERR(AliLog::kDebug, level, Class()->GetName(), whatever)
379 #define ToAliDebugClass(level, whatever) REDIRECTSTDOUTANDSTDERR(AliLog::kDebug, level, Class()->GetName(), whatever)
380 #define StdoutToAliDebugGeneral(scope, level, whatever) REDIRECTSTDOUT(AliLog::kDebug, level, scope, whatever)
381 #define StderrToAliDebugGeneral(scope, level, whatever) REDIRECTSTDERR(AliLog::kDebug, level, scope, whatever)
382 #define ToAliDebugGeneral(scope, level, whatever) REDIRECTSTDOUTANDSTDERR(AliLog::kDebug, level, scope, whatever)
383
384 // debug stream objects
385 #define AliDebugStream(level) AliLog::Stream(AliLog::kDebug, level, MODULENAME(), ClassName(), FUNCTIONNAME(), __FILE__, __LINE__)
386 #define AliDebugClassStream(level) AliLog::Stream(AliLog::kDebug, level, MODULENAME(), Class()->GetName(), FUNCTIONNAME(), __FILE__, __LINE__)
387 #define AliDebugGeneralStream(scope, level) AliLog::Stream(AliLog::kDebug, level, MODULENAME(), scope, FUNCTIONNAME(), __FILE__, __LINE__)
388
389
390 /** 
391  * Macro that will output stuff using the logging facilities. 
392  * 
393  * @param lvl     Message level 
394  * @param message Message to show 
395  */
396 #define AliMessage(lvl,message) do { \
397       AliLog::Message(lvl, message, MODULENAME(), ClassName(), FUNCTIONNAME(), __FILE__, __LINE__);} while(false) 
398 /** 
399  * Macro that will output stuff using the logging facilities. 
400  * For use in static member function of ROOT-enabled class-scope.
401  *
402  * @param lvl     Message level 
403  * @param message Message to show 
404  */
405 #define AliMessageClass(lvl,message) do { \
406     AliLog::Message(lvl, message, MODULENAME(), Class()->GetName(), FUNCTIONNAME(), __FILE__, __LINE__);} while(false) 
407 /** 
408  * Macro that will output stuff using the logging facilities. 
409  * For use in non-ROOT-enabled class-scope.
410  *
411  * @param scope   Scope 
412  * @param lvl     Message level 
413  * @param message Message to show 
414  */
415 #define AliMessageGeneral(scope,lvl,message) do {                       \
416     AliLog::Message(lvl, message, MODULENAME(), scope, FUNCTIONNAME(), __FILE__, __LINE__);} while(false) 
417 /** 
418  * Print a message using the AliLog logging facility. This macro
419  * accepts printf-like format arguments.  Note, at least 3 arguments
420  * must be passed.  
421  * @code
422  *   AliMessageF(1, "foo");        // <-- Failes
423  *   AliMessageF(1, "foo %d", 42); // <-- OK
424  * @endcode
425  *
426  * @param lvl     Message level
427  * @param format  printf-like format
428  */
429 #define AliMessageF(lvl,format,...) do { \
430   TString m; m.Form(format,__VA_ARGS__); \
431   AliLog::Message(lvl, m, MODULENAME(), ClassName(), FUNCTIONNAME(), __FILE__, __LINE__);} while(false) 
432 /** 
433  * Print a message using the AliLog logging facility. This macro
434  * accepts printf-like format arguments.  Note, at least 3 arguments
435  * must be passed.  
436  * @code
437  *   AliMessageF(1, "foo");        // <-- Failes
438  *   AliMessageF(1, "foo %d", 42); // <-- OK
439  * @endcode
440  *
441  * This is for static member function in for ROOT-enabled class-scope
442  *
443  * @param lvl     Message level
444  * @param format  printf-like format
445  */
446 #define AliMessageClassF(lvl,format,...) do { \
447   TString m; m.Form(format,__VA_ARGS__); \
448   AliLog::Message(lvl, m, MODULENAME(), Class()->GetName(), FUNCTIONNAME(), __FILE__, __LINE__);} while(false) 
449 /** 
450  * Print a message using the AliLog logging facility. This macro
451  * accepts printf-like format arguments.  Note, at least 3 arguments
452  * must be passed.  
453  * @code
454  *   AliMessageF(1, "foo");        // <-- Failes
455  *   AliMessageF(1, "foo %d", 42); // <-- OK
456  * @endcode
457  *
458  * This is for non-ROOT-enabled class-scope
459  *
460  * @param scope   Scope 
461  * @param lvl     Message level
462  * @param format  printf-like format
463  */
464 #define AliMessageGeneralF(scope,lvl,format,...) do {   \
465   TString m; m.Form(format,__VA_ARGS__); \
466   AliLog::Message(lvl, m, MODULENAME(), scope, FUNCTIONNAME(), __FILE__, __LINE__);} while(false) 
467
468 // info messages
469 #ifdef LOG_NO_INFO
470 # define AliInfo(message) do { } while (false)
471 # define AliInfoClass(message) do { } while (false)
472 # define AliInfoGeneral(scope, message) do { } while (false)
473 # define AliInfoF(message,...) do { } while (false)
474 # define AliInfoClassF(message,...) do { } while (false)
475 # define AliInfoGeneralF(scope, message,...) do { } while (false)
476 #else
477 /**
478  * Forwards to AliMessage with log level of AliLog::kInfo
479  * @see AliMessage 
480  */
481 # define AliInfo(message)               AliMessage(AliLog::kInfo, message)
482 /**
483  * Forwards to AliMessageClass with log level of AliLog::kInfo
484  * @see AliMessageClass 
485  */
486 # define AliInfoClass(message)          AliMessageClass(AliLog::kInfo, message)
487 /**
488  * Forwards to AliMessageGeneral with log level of AliLog::kInfo
489  * @see AliMessageGeneral
490  */
491 # define AliInfoGeneral(scope, message) AliMessageGeneral(scope, AliLog::kInfo, message)
492 /**
493  * Forwards to AliMessageF with log level of AliLog::kInfo
494  * @see AliMessageF 
495  */
496 # define AliInfoF(message,...)               AliMessageF(AliLog::kInfo, message, __VA_ARGS__)
497 /**
498  * Forwards to AliMessageClassF with log level of AliLog::kInfo
499  * @see AliMessageClassF 
500  */
501 # define AliInfoClassF(message,...)          AliMessageClassF(AliLog::kInfo, message, __VA_ARGS__)
502 /**
503  * Forwards to AliMessageGeneralF with log level of AliLog::kInfo
504  * @see AliMessageGeneralF
505  */
506 # define AliInfoGeneralF(scope,message,...)  AliMessageGeneralF(scope, AliLog::kInfo, message, __VA_ARGS__)
507 #endif
508
509 // redirection to info
510 #define StdoutToAliInfo(whatever) REDIRECTSTDOUT(AliLog::kInfo, 0, ClassName(), whatever)
511 #define StderrToAliInfo(whatever) REDIRECTSTDERR(AliLog::kInfo, 0, ClassName(), whatever)
512 #define ToAliInfo(whatever) REDIRECTSTDOUTANDSTDERR(AliLog::kInfo, 0, ClassName(), whatever)
513 #define StdoutToAliInfoClass(whatever) REDIRECTSTDOUT(AliLog::kInfo, 0, Class()->GetName(), whatever)
514 #define StderrToAliInfoClass(whatever) REDIRECTSTDERR(AliLog::kInfo, 0, Class()->GetName(), whatever)
515 #define ToAliInfoClass(whatever) REDIRECTSTDOUTANDSTDERR(AliLog::kInfo, 0, Class()->GetName(), whatever)
516 #define StdoutToAliInfoGeneral(scope, whatever) REDIRECTSTDOUT(AliLog::kInfo, 0, scope, whatever)
517 #define StderrToAliInfoGeneral(scope, whatever) REDIRECTSTDERR(AliLog::kInfo, 0, scope, whatever)
518 #define ToAliInfoGeneral(scope, whatever) REDIRECTSTDOUTANDSTDERR(AliLog::kInfo, 0, scope, whatever)
519
520 // info stream objects
521 #define AliInfoStream() AliLog::Stream(AliLog::kInfo, 0, MODULENAME(), ClassName(), FUNCTIONNAME(), __FILE__, __LINE__)
522 #define AliInfoClassStream() AliLog::Stream(AliLog::kInfo, 0, MODULENAME(), Class()->GetName(), FUNCTIONNAME(), __FILE__, __LINE__)
523 #define AliInfoGeneralStream(scope) AliLog::Stream(AliLog::kInfo, 0, MODULENAME(), scope, FUNCTIONNAME(), __FILE__, __LINE__)
524
525 // warning messages
526 #ifdef LOG_NO_WARNING
527 # define AliWarning(message) do { } while (false)
528 # define AliWarningClass(message) do { } while (false)
529 # define AliWarningGeneral(scope, message) do { } while (false)
530 # define AliWarningF(message,...) do { } while (false)
531 # define AliWarningClassF(message,...) do { } while (false)
532 # define AliWarningGeneralF(scope, message,...) do { } while (false)
533 #else
534 /**
535  * Forwards to AliMessage with log level of AliLog::kWarning
536  * @see AliMessage 
537  */
538 # define AliWarning(message)               AliMessage(AliLog::kWarning, message)
539 /**
540  * Forwards to AliMessageClass with log level of AliLog::kWarning
541  * @see AliMessageClass 
542  */
543 # define AliWarningClass(message)          AliMessageClass(AliLog::kWarning, message)
544 /**
545  * Forwards to AliMessageGeneral with log level of AliLog::kWarning
546  * @see AliMessageGeneral
547  */
548 # define AliWarningGeneral(scope, message) AliMessageGeneral(scope, AliLog::kWarning, message)
549 /**
550  * Forwards to AliMessageF with log level of AliLog::kWarning
551  * @see AliMessageF 
552  */
553 # define AliWarningF(message,...)               AliMessageF(AliLog::kWarning, message, __VA_ARGS__)
554 /**
555  * Forwards to AliMessageClassF with log level of AliLog::kWarning
556  * @see AliMessageClassF 
557  */
558 # define AliWarningClassF(message,...)          AliMessageClassF(AliLog::kWarning, message, __VA_ARGS__)
559 /**
560  * Forwards to AliMessageGeneralF with log level of AliLog::kWarning
561  * @see AliMessageGeneralF
562  */
563 # define AliWarningGeneralF(scope,message,...)  AliMessageGeneralF(scope, AliLog::kWarning, message, __VA_ARGS__)
564 #endif
565
566 // redirection to warning
567 #define StdoutToAliWarning(whatever) REDIRECTSTDOUT(AliLog::kWarning, 0, ClassName(), whatever)
568 #define StderrToAliWarning(whatever) REDIRECTSTDERR(AliLog::kWarning, 0, ClassName(), whatever)
569 #define ToAliWarning(whatever) REDIRECTSTDOUTANDSTDERR(AliLog::kWarning, 0, ClassName(), whatever)
570 #define StdoutToAliWarningClass(whatever) REDIRECTSTDOUT(AliLog::kWarning, 0, Class()->GetName(), whatever)
571 #define StderrToAliWarningClass(whatever) REDIRECTSTDERR(AliLog::kWarning, 0, Class()->GetName(), whatever)
572 #define ToAliWarningClass(whatever) REDIRECTSTDOUTANDSTDERR(AliLog::kWarning, 0, Class()->GetName(), whatever)
573 #define StdoutToAliWarningGeneral(scope, whatever) REDIRECTSTDOUT(AliLog::kWarning, 0, scope, whatever)
574 #define StderrToAliWarningGeneral(scope, whatever) REDIRECTSTDERR(AliLog::kWarning, 0, scope, whatever)
575 #define ToAliWarningGeneral(scope, whatever) REDIRECTSTDOUTANDSTDERR(AliLog::kWarning, 0, scope, whatever)
576
577 // warning stream objects
578 #define AliWarningStream() AliLog::Stream(AliLog::kWarning, 0, MODULENAME(), ClassName(), FUNCTIONNAME(), __FILE__, __LINE__)
579 #define AliWarningClassStream() AliLog::Stream(AliLog::kWarning, 0, MODULENAME(), Class()->GetName(), FUNCTIONNAME(), __FILE__, __LINE__)
580 #define AliWarningGeneralStream(scope) AliLog::Stream(AliLog::kWarning, 0, MODULENAME(), scope, FUNCTIONNAME(), __FILE__, __LINE__)
581
582
583 // error messages
584 /**
585  * Forwards to AliMessage with log level of AliLog::kError
586  * @see AliMessage 
587  */
588 #define AliError(message)               AliMessage(AliLog::kError, message)
589 /**
590  * Forwards to AliMessageClass with log level of AliLog::kError
591  * @see AliMessageClass 
592  */
593 #define AliErrorClass(message)          AliMessageClass(AliLog::kError, message)
594 /**
595  * Forwards to AliMessageGeneral with log level of AliLog::kError
596  * @see AliMessageGeneral
597  */
598 #define AliErrorGeneral(scope, message) AliMessageGeneral(scope, AliLog::kError, message)
599 /**
600  * Forwards to AliMessageF with log level of AliLog::kError
601  * @see AliMessageF 
602  */
603 #define AliErrorF(message,...)               AliMessageF(AliLog::kError, message, __VA_ARGS__)
604 /**
605  * Forwards to AliMessageClassF with log level of AliLog::kError
606  * @see AliMessageClassF 
607  */
608 #define AliErrorClassF(message,...)          AliMessageClassF(AliLog::kError, message, __VA_ARGS__)
609 /**
610  * Forwards to AliMessageGeneralF with log level of AliLog::kError
611  * @see AliMessageGeneralF
612  */
613 #define AliErrorGeneralF(scope,message,...)  AliMessageGeneralF(scope, AliLog::kError, message, __VA_ARGS__)
614
615 // redirection to error
616 #define StdoutToAliError(whatever) REDIRECTSTDOUT(AliLog::kError, 0, ClassName(), whatever)
617 #define StderrToAliError(whatever) REDIRECTSTDERR(AliLog::kError, 0, ClassName(), whatever)
618 #define ToAliError(whatever) REDIRECTSTDOUTANDSTDERR(AliLog::kError, 0, ClassName(), whatever)
619 #define StdoutToAliErrorClass(whatever) REDIRECTSTDOUT(AliLog::kError, 0, Class()->GetName(), whatever)
620 #define StderrToAliErrorClass(whatever) REDIRECTSTDERR(AliLog::kError, 0, Class()->GetName(), whatever)
621 #define ToAliErrorClass(whatever) REDIRECTSTDOUTANDSTDERR(AliLog::kError, 0, Class()->GetName(), whatever)
622 #define StdoutToAliErrorGeneral(scope, whatever) REDIRECTSTDOUT(AliLog::kError, 0, scope, whatever)
623 #define StderrToAliErrorGeneral(scope, whatever) REDIRECTSTDERR(AliLog::kError, 0, scope, whatever)
624 #define ToAliErrorGeneral(scope, whatever) REDIRECTSTDOUTANDSTDERR(AliLog::kError, 0, scope, whatever)
625
626 // error stream objects
627 #define AliErrorStream() AliLog::Stream(AliLog::kError, 0, MODULENAME(), ClassName(), FUNCTIONNAME(), __FILE__, __LINE__)
628 #define AliErrorClassStream() AliLog::Stream(AliLog::kError, 0, MODULENAME(), Class()->GetName(), FUNCTIONNAME(), __FILE__, __LINE__)
629 #define AliErrorGeneralStream(scope) AliLog::Stream(AliLog::kError, 0, MODULENAME(), scope, FUNCTIONNAME(), __FILE__, __LINE__)
630
631
632 // fatal messages
633 /**
634  * Forwards to AliMessage with log level of AliLog::kFatal
635  * @see AliMessage 
636  */
637 #define AliFatal(message)               AliMessage(AliLog::kFatal, message)
638 /**
639  * Forwards to AliMessageClass with log level of AliLog::kFatal
640  * @see AliMessageClass 
641  */
642 #define AliFatalClass(message)          AliMessageClass(AliLog::kFatal, message)
643 /**
644  * Forwards to AliMessageGeneral with log level of AliLog::kFatal
645  * @see AliMessageGeneral
646  */
647 #define AliFatalGeneral(scope, message) AliMessageGeneral(scope, AliLog::kFatal, message)
648 /**
649  * Forwards to AliMessageF with log level of AliLog::kFatal
650  * @see AliMessageF 
651  */
652 #define AliFatalF(message,...)               AliMessageF(AliLog::kFatal, message, __VA_ARGS__)
653 /**
654  * Forwards to AliMessageClassF with log level of AliLog::kFatal
655  * @see AliMessageClassF 
656  */
657 #define AliFatalClassF(message,...)          AliMessageClassF(AliLog::kFatal, message, __VA_ARGS__)
658 /**
659  * Forwards to AliMessageGeneralF with log level of AliLog::kFatal
660  * @see AliMessageGeneralF
661  */
662 #define AliFatalGeneralF(scope,message,...)  AliMessageGeneralF(scope, AliLog::kFatal, message, __VA_ARGS__)
663
664 #endif