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