ROOT logo
#ifndef ALILOG_H
#define ALILOG_H
/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
 * See cxx source for full Copyright notice                               */

/* $Id$ */

#include <TClass.h>
#include <TObjArray.h>
#include <TObject.h>
#include <TString.h>

using std::ostream;

// deprecation macro
#if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
# define ALIROOT_DEPRECATED(func) func  __attribute__ ((deprecated))
#elif defined(_MSC_VER) && _MSC_VER >= 1300
# define ALIROOT_DEPRECATED(func) __declspec(deprecated) func
#else
# define ALIROOT_DEPRECATED(func) func
#endif

/**
 * class for logging debug, info and error messages
 */
class AliLog: public TObject
{
 public:

		// Log4j log levels: TRACE, DEBUG, INFO, WARN, ERROR, FATAL
  enum EType_t {kFatal = 0, kError, kWarning, kInfo, kDebug, kMaxType};
  typedef void (*AliLogNotification)(EType_t type, const char* message );

		// NB: singleton constructor & destructor should not be public!
		// ALIROOT_DEPRECATED(AliLog());
		// ALIROOT_DEPRECATED(virtual ~AliLog());

		// NB: singleton deprecated static instance method
		// ALIROOT_DEPRECATED(static AliLog* Instance() {return fgInstance;};)

		// get root logger singleton instance
		static AliLog *GetRootLogger();

		// delete root logger singleton instance
		static void DeleteRootLogger(); 

		// NB: the following functions should not be static
		// NB: deprecated: logging configuration should be made through to a configuration file
  static void  EnableCoreDump(Bool_t enabled);
  static void MakeCoreDump(const char *fout);	
  static void  EnableDebug(Bool_t enabled);
  static void  SetGlobalLogLevel(EType_t type);
  static Int_t GetGlobalLogLevel();
  static void  SetGlobalDebugLevel(Int_t level);
  static Int_t GetGlobalDebugLevel();
  static void  SetModuleDebugLevel(const char* module, Int_t level);
  static void  ClearModuleDebugLevel(const char* module);
  static void  SetClassDebugLevel(const char* className, Int_t level);
  static void  ClearClassDebugLevel(const char* className);

  static void  SetStandardOutput();
  static void  SetStandardOutput(EType_t type);
  static void  SetErrorOutput();
  static void  SetErrorOutput(EType_t type);
  static void  SetFileOutput(const char* fileName);
  static void  SetFileOutput(EType_t type, const char* fileName);
  static void  SetStreamOutput(ostream* stream);
  static void  SetStreamOutput(EType_t type, ostream* stream);
  static void  SetLogNotification(AliLogNotification pCallBack);
  static void  SetLogNotification(EType_t type, AliLogNotification pCallBack);
  static void  Flush();

  static void  SetHandleRootMessages(Bool_t on);

  static void  SetPrintType(Bool_t on);
  static void  SetPrintType(EType_t type, Bool_t on);
  static void  SetPrintModule(Bool_t on);
  static void  SetPrintModule(EType_t type, Bool_t on);
  static void  SetPrintScope(Bool_t on);
  static void  SetPrintScope(EType_t type, Bool_t on);
  static void  SetPrintLocation(Bool_t on);
  static void  SetPrintLocation(EType_t type, Bool_t on);

  static void  SetPrintRepetitions(Bool_t on);

  static void  WriteToFile(const char* name, Int_t option = 0);

  // the following public methods are used by the preprocessor macros 
  // and should not be called directly
  static Bool_t IsDebugEnabled() {return fgDebugEnabled;}
  static Int_t GetDebugLevel(const char* module, const char* className);
  static void  Message(UInt_t level, const char* message, 
                       const char* module, const char* className,
                       const char* function, const char* file, Int_t line);
  static void  Debug(UInt_t level, const char* message, 
                     const char* module, const char* className,
                     const char* function, const char* file, Int_t line);

  static Int_t RedirectStdoutTo(EType_t type, UInt_t level, const char* module, 
                                const char* className, const char* function,
                                const char* file, Int_t line, Bool_t print);
  static Int_t RedirectStderrTo(EType_t type, UInt_t level, const char* module, 
                                const char* className, const char* function,
                                const char* file, Int_t line, Bool_t print);
  static void  RestoreStdout(Int_t original);
  static void  RestoreStderr(Int_t original);

  static ostream& Stream(EType_t type, UInt_t level,
                         const char* module, const char* className,
                         const char* function, const char* file, Int_t line);
  static void TestException(Int_t level=10); 
 private:

		// constructor is made private for implementing a singleton
		AliLog();
		virtual ~AliLog();

		// NOT IMPLEMENTED?
  AliLog(const AliLog& log);
  AliLog& operator = (const AliLog& log);

  void           ReadEnvSettings();

  static void    RootErrorHandler(Int_t level, Bool_t abort, 
				  const char* location, const char* message);

  void           CloseFile(Int_t type);
  FILE*          GetOutputStream(Int_t type);

  UInt_t         GetLogLevel(const char* module, const char* className) const;
  void           PrintMessage(UInt_t type, const char* message, 
                              const char* module, const char* className,
                              const char* function, 
                              const char* file, Int_t line);

  void           PrintString(Int_t type, FILE* stream, const char* format, ...);
  void           PrintRepetitions();

  Int_t          RedirectTo(FILE* stream, EType_t type, UInt_t level,
                            const char* module, const char* className,
                            const char* function,
                            const char* file, Int_t line, Bool_t print);

  ostream&       GetStream(EType_t type, UInt_t level,
                           const char* module, const char* className,
                           const char* function, const char* file, Int_t line);

  enum {kDebugOffset = kDebug-1};

  static AliLog* fgInstance;                 //! pointer to current instance
  static Bool_t  fgDebugEnabled;             // flag for debug en-/disabling
  static Bool_t  fgCoreEnabled;             // flag for core dump en-/disabling

  UInt_t         fGlobalLogLevel;            // global logging level
  TObjArray      fModuleDebugLevels;         // debug levels for modules
  TObjArray      fClassDebugLevels;          // debug levels for classes

  Int_t          fOutputTypes[kMaxType];     // types of output streams
  TString        fFileNames[kMaxType];       // file names
  FILE*          fOutputFiles[kMaxType];     //! log output files
  ostream*       fOutputStreams[kMaxType];   //! log output streams

  Bool_t         fPrintType[kMaxType];       // print type on/off
  Bool_t         fPrintModule[kMaxType];     // print module on/off
  Bool_t         fPrintScope[kMaxType];      // print scope/class name on/off
  Bool_t         fPrintLocation[kMaxType];   // print file and line on/off

  Bool_t         fPrintRepetitions;          // print number of repetitions instead of repeated message on/off

  Int_t          fRepetitions;               //! counter of repetitions
  UInt_t         fLastType;                  //! type of last message
  TString        fLastMessage;               //! last message
  TString        fLastModule;                //! module name of last message
  TString        fLastClassName;             //! class name of last message
  TString        fLastFunction;              //! function name of last message
  TString        fLastFile;                  //! file name of last message
  Int_t          fLastLine;                  //! line number of last message
  AliLogNotification fCallBacks[kMaxType];   //! external notification callback

  ClassDef(AliLog, 1)   // class for logging debug, info and error messages
};


// module name macro
#ifdef _MODULE_
# define MODULENAME() _MODULE_
#else
# define MODULENAME() "NoModule"
#endif

// function name macro
#if defined(__GNUC__) || defined(__ICC) || defined(__ECC) || defined(__APPLE__)
# define FUNCTIONNAME() __FUNCTION__
// #elif defined(__HP_aCC) || defined(__alpha) || defined(__DECCXX)
// #define FUNCTIONNAME() __FUNC__
#else
# define FUNCTIONNAME() "???"
#endif

// redirection
/** 
 * Redirect output to std::cout to specified log stream 
 * 
 * @param type      Type of stream to re-direct to
 * @param level     Level of output
 * @param scope     Scope
 * @param whatever  Any code that will output to std::cout 
 */
#define REDIRECTSTDOUT(type, level, scope, whatever) \
  do {Int_t originalStdout = AliLog::RedirectStdoutTo(type, level, MODULENAME(), scope, FUNCTIONNAME(), __FILE__, __LINE__, kFALSE); \
    whatever; AliLog::RestoreStdout(originalStdout);} while(false)
/** 
 * Redirect output to std::cerr to specified log stream 
 * 
 * @param type      Type of stream to re-direct to
 * @param level     Level of output
 * @param scope     Scope
 * @param whatever  Any code that will output to std::cout 
 */
#define REDIRECTSTDERR(type, level, scope, whatever) \
  do {Int_t originalStderr = AliLog::RedirectStderrTo(type, level, MODULENAME(), scope, FUNCTIONNAME(), __FILE__, __LINE__, kFALSE); \
    whatever; AliLog::RestoreStderr(originalStderr);} while(false)
/** 
 * Redirect output to std::cout and std::cerr to specified log stream 
 * 
 * @param type      Type of stream to re-direct to
 * @param level     Level of output
 * @param scope     Scope
 * @param whatever  Any code that will output to std::cout or std::cerr
 */
#define REDIRECTSTDOUTANDSTDERR(type, level, scope, whatever) \
  do {Int_t originalStdout = AliLog::RedirectStdoutTo(type, level, MODULENAME(), scope, FUNCTIONNAME(), __FILE__, __LINE__, kFALSE); \
    Int_t originalStderr = AliLog::RedirectStderrTo(type, level, MODULENAME(), scope, FUNCTIONNAME(), __FILE__, __LINE__, kFALSE); \
    whatever; AliLog::RestoreStderr(originalStderr); AliLog::RestoreStdout(originalStdout);} while(false)


// debug level
#ifdef LOG_NO_DEBUG
# define AliDebugLevel() -1
# define AliDebugLevelClass() -1
# define AliDebugLevelGeneral(scope) -1
#else
/** 
 * Get the object scope debug level
 */
# define AliDebugLevel() ((AliLog::IsDebugEnabled()) ? AliLog::GetDebugLevel(MODULENAME(), ClassName()) : -1)
/** 
 * Get the class (ROOT-enabled) debug level
 */
# define AliDebugLevelClass() ((AliLog::IsDebugEnabled()) ? AliLog::GetDebugLevel(MODULENAME(), Class()->GetName()) : -1)
/**
 * Get the debug level associated with scope 
 * @param scope Scope 
 */
# define AliDebugLevelGeneral(scope) ((AliLog::IsDebugEnabled()) ? AliLog::GetDebugLevel(MODULENAME(), scope) : -1)
#endif

// debug messages
#ifdef LOG_NO_DEBUG
# define AliDebug(level, message) do { } while (false)
# define AliDebugClass(level, message) do { } while (false)
# define AliDebugGeneral(scope, level, message) do { } while (false)
# define AliDebugF(level, message,...) do { } while (false)
# define AliDebugClassF(level, message,...) do { } while (false)
# define AliDebugGeneralF(scope, level, message,...) do { } while (false)
#else

// inspired by log4cxx code (see log4cxx/Logger.h)
// implements GCC branch prediction for increasing logging performance
# if !defined(ALIROOT_UNLIKELY)
#  if defined(__GNUC__) && (__GNUC__ >= 3)
/**
 * Provides optimization hint to the compiler
 * to optimize for the expression being false.
 * @param expr boolean expression.
 * @returns value of expression.
 */
#   define ALIROOT_UNLIKELY(expr) __builtin_expect(expr, 0)
#  else
/**
 * Provides optimization hint to the compiler
 * to optimize for the expression being false.
 * @param expr boolean expression.
 * @returns value of expression.
 */
#   define ALIROOT_UNLIKELY(expr) expr
#  endif
# endif 

/**
 * 
 * Logs a message to a specified logger with the DEBUG level.
 * 
 * @param logLevel the debug level.
 * @param message message to print in the following format: Form(message).
 * Note, that message should contain balanced parenthesis, like 
 * <code>AliDebug(1, Form("Failed to decode line %d of %s", line, filename));</code> 
 */
# define AliDebug(logLevel, message) \
        do { if (ALIROOT_UNLIKELY(AliLog::IsDebugEnabled() && AliLog::GetDebugLevel(MODULENAME(), ClassName()) >= logLevel)) {\
	  AliLog::Debug(logLevel, message, MODULENAME(), ClassName(), FUNCTIONNAME(), __FILE__, __LINE__); }} while (0)
/**
 * 
 * Logs a message to a specified logger with the DEBUG level.  For use
 * in static member functions of a class 
 * 
 * @param logLevel the debug level.
 * @param message message to print in the following format: Form(message).
 * Note, that message should contain balanced parenthesis, like 
 * <code>AliDebug(1, Form("Failed to decode line %d of %s", line, filename));</code> 
 */
# define AliDebugClass(logLevel, message) \
	do { if (ALIROOT_UNLIKELY(AliLog::IsDebugEnabled() && AliLog::GetDebugLevel(MODULENAME(), Class()->GetName()) >= logLevel)) {\
	  AliLog::Debug(logLevel, message, MODULENAME(), Class()->GetName(), FUNCTIONNAME(), __FILE__, __LINE__); }} while (0)

/**
 * Logs a message to a specified logger with the DEBUG level.  For use
 * in non-ROOT-enabled-class scope.
 * 
 * @param scope the logging scope.
 * @param logLevel the debug level.
 * @param message message to print in the following format: Form(message).
 * Note, that message should contain balanced parenthesis, like 
 * <code>AliDebug(1, Form("Failed to decode line %d of %s", line, filename));</code> 
*/
# define AliDebugGeneral(scope, logLevel, message) \
	do { if (ALIROOT_UNLIKELY(AliLog::IsDebugEnabled() && AliLog::GetDebugLevel(MODULENAME(), scope) >= logLevel)) {\
	  AliLog::Debug(logLevel, message, MODULENAME(), scope, FUNCTIONNAME(), __FILE__, __LINE__); }} while (0)
/** 
 * Macro to output debugging information.  This excepts a printf-like
 * format statement.   Note, at least 3 arguments (in total) must be
 * passed. 
 * 
 * @param logLevel Debug level
 * @param format   Printf-like format. 
 */
# define AliDebugF(logLevel,format,...) \
do { if (ALIROOT_UNLIKELY(AliLog::IsDebugEnabled() && AliLog::GetDebugLevel(MODULENAME(), ClassName()) >= logLevel)) { \
    TString m;m.Form(format,__VA_ARGS__);					\
    AliLog::Debug(logLevel, m, MODULENAME(), ClassName(), FUNCTIONNAME(), __FILE__, __LINE__); }} while (0)
/** 
 * Outut debug information, filtered on debug level.  For use in
 * static member function of a ROOT-enabled class. This excepts a
 * printf-like format statement.  Note, at least 3 arguments (in
 * total) must be passed.
 * 
 * @param logLevel Debug level
 * @param format   Printf-like format 
 * 
 * @return 
 */
# define AliDebugClassF(logLevel,format,...) \
  do { if (ALIROOT_UNLIKELY(AliLog::IsDebugEnabled() && AliLog::GetDebugLevel(MODULENAME(), Class()->GetName()) >= logLevel)) { \
      TString m;m.Form(format,__VA_ARGS__);					\
      AliLog::Debug(logLevel, m, MODULENAME(), Class()->GetName(), FUNCTIONNAME(), __FILE__, __LINE__); }} while (0)
/** 
 * Outut debug information, filtered on debug level.  For use in
 * static member function of a non-ROOT-enabled class-scope. This
 * excepts a printf-like format statement.  Note, at least 3 arguments
 * (in total) must be passed.
 * 
 * @param scope    Scope 
 * @param logLevel Debug level
 * @param format   Printf-like format 
 * 
 * @return 
 */
# define AliDebugGeneralF(scope,logLevel,format,...) \
  do { if (ALIROOT_UNLIKELY(AliLog::IsDebugEnabled() && AliLog::GetDebugLevel(MODULENAME(), scope) >= logLevel)) { \
      TString m;m.Form(format,__VA_ARGS__);					\
      AliLog::Debug(logLevel, m, MODULENAME(), scope, FUNCTIONNAME(), __FILE__, __LINE__); }} while (0)
    
#endif

// redirection to debug
#define StdoutToAliDebug(level, whatever) REDIRECTSTDOUT(AliLog::kDebug, level, ClassName(), whatever)
#define StderrToAliDebug(level, whatever) REDIRECTSTDERR(AliLog::kDebug, level, ClassName(), whatever)
#define ToAliDebug(level, whatever) REDIRECTSTDOUTANDSTDERR(AliLog::kDebug, level, ClassName(), whatever)
#define StdoutToAliDebugClass(level, whatever) REDIRECTSTDOUT(AliLog::kDebug, level, Class()->GetName(), whatever)
#define StderrToAliDebugClass(level, whatever) REDIRECTSTDERR(AliLog::kDebug, level, Class()->GetName(), whatever)
#define ToAliDebugClass(level, whatever) REDIRECTSTDOUTANDSTDERR(AliLog::kDebug, level, Class()->GetName(), whatever)
#define StdoutToAliDebugGeneral(scope, level, whatever) REDIRECTSTDOUT(AliLog::kDebug, level, scope, whatever)
#define StderrToAliDebugGeneral(scope, level, whatever) REDIRECTSTDERR(AliLog::kDebug, level, scope, whatever)
#define ToAliDebugGeneral(scope, level, whatever) REDIRECTSTDOUTANDSTDERR(AliLog::kDebug, level, scope, whatever)

// debug stream objects
#define AliDebugStream(level) AliLog::Stream(AliLog::kDebug, level, MODULENAME(), ClassName(), FUNCTIONNAME(), __FILE__, __LINE__)
#define AliDebugClassStream(level) AliLog::Stream(AliLog::kDebug, level, MODULENAME(), Class()->GetName(), FUNCTIONNAME(), __FILE__, __LINE__)
#define AliDebugGeneralStream(scope, level) AliLog::Stream(AliLog::kDebug, level, MODULENAME(), scope, FUNCTIONNAME(), __FILE__, __LINE__)


/** 
 * Macro that will output stuff using the logging facilities. 
 * 
 * @param lvl     Message level 
 * @param message Message to show 
 */
#define AliMessage(lvl,message) do { \
      AliLog::Message(lvl, message, MODULENAME(), ClassName(), FUNCTIONNAME(), __FILE__, __LINE__);} while(false) 
/** 
 * Macro that will output stuff using the logging facilities. 
 * For use in static member function of ROOT-enabled class-scope.
 *
 * @param lvl     Message level 
 * @param message Message to show 
 */
#define AliMessageClass(lvl,message) do { \
    AliLog::Message(lvl, message, MODULENAME(), Class()->GetName(), FUNCTIONNAME(), __FILE__, __LINE__);} while(false) 
/** 
 * Macro that will output stuff using the logging facilities. 
 * For use in non-ROOT-enabled class-scope.
 *
 * @param scope   Scope 
 * @param lvl     Message level 
 * @param message Message to show 
 */
#define AliMessageGeneral(scope,lvl,message) do {			\
    AliLog::Message(lvl, message, MODULENAME(), scope, FUNCTIONNAME(), __FILE__, __LINE__);} while(false) 
/** 
 * Print a message using the AliLog logging facility. This macro
 * accepts printf-like format arguments.  Note, at least 3 arguments
 * must be passed.  
 * @code
 *   AliMessageF(1, "foo");        // <-- Failes
 *   AliMessageF(1, "foo %d", 42); // <-- OK
 * @endcode
 *
 * @param lvl     Message level
 * @param format  printf-like format
 */
#define AliMessageF(lvl,format,...) do { \
  TString m; m.Form(format,__VA_ARGS__); \
  AliLog::Message(lvl, m, MODULENAME(), ClassName(), FUNCTIONNAME(), __FILE__, __LINE__);} while(false) 
/** 
 * Print a message using the AliLog logging facility. This macro
 * accepts printf-like format arguments.  Note, at least 3 arguments
 * must be passed.  
 * @code
 *   AliMessageF(1, "foo");        // <-- Failes
 *   AliMessageF(1, "foo %d", 42); // <-- OK
 * @endcode
 *
 * This is for static member function in for ROOT-enabled class-scope
 *
 * @param lvl     Message level
 * @param format  printf-like format
 */
#define AliMessageClassF(lvl,format,...) do { \
  TString m; m.Form(format,__VA_ARGS__); \
  AliLog::Message(lvl, m, MODULENAME(), Class()->GetName(), FUNCTIONNAME(), __FILE__, __LINE__);} while(false) 
/** 
 * Print a message using the AliLog logging facility. This macro
 * accepts printf-like format arguments.  Note, at least 3 arguments
 * must be passed.  
 * @code
 *   AliMessageF(1, "foo");        // <-- Failes
 *   AliMessageF(1, "foo %d", 42); // <-- OK
 * @endcode
 *
 * This is for non-ROOT-enabled class-scope
 *
 * @param scope   Scope 
 * @param lvl     Message level
 * @param format  printf-like format
 */
#define AliMessageGeneralF(scope,lvl,format,...) do {	\
  TString m; m.Form(format,__VA_ARGS__); \
  AliLog::Message(lvl, m, MODULENAME(), scope, FUNCTIONNAME(), __FILE__, __LINE__);} while(false) 

// info messages
#ifdef LOG_NO_INFO
# define AliInfo(message) do { } while (false)
# define AliInfoClass(message) do { } while (false)
# define AliInfoGeneral(scope, message) do { } while (false)
# define AliInfoF(message,...) do { } while (false)
# define AliInfoClassF(message,...) do { } while (false)
# define AliInfoGeneralF(scope, message,...) do { } while (false)
#else
/**
 * Forwards to AliMessage with log level of AliLog::kInfo
 * @see AliMessage 
 */
# define AliInfo(message)               AliMessage(AliLog::kInfo, message)
/**
 * Forwards to AliMessageClass with log level of AliLog::kInfo
 * @see AliMessageClass 
 */
# define AliInfoClass(message)          AliMessageClass(AliLog::kInfo, message)
/**
 * Forwards to AliMessageGeneral with log level of AliLog::kInfo
 * @see AliMessageGeneral
 */
# define AliInfoGeneral(scope, message) AliMessageGeneral(scope, AliLog::kInfo, message)
/**
 * Forwards to AliMessageF with log level of AliLog::kInfo
 * @see AliMessageF 
 */
# define AliInfoF(message,...)               AliMessageF(AliLog::kInfo, message, __VA_ARGS__)
/**
 * Forwards to AliMessageClassF with log level of AliLog::kInfo
 * @see AliMessageClassF 
 */
# define AliInfoClassF(message,...)          AliMessageClassF(AliLog::kInfo, message, __VA_ARGS__)
/**
 * Forwards to AliMessageGeneralF with log level of AliLog::kInfo
 * @see AliMessageGeneralF
 */
# define AliInfoGeneralF(scope,message,...)  AliMessageGeneralF(scope, AliLog::kInfo, message, __VA_ARGS__)
#endif

// redirection to info
#define StdoutToAliInfo(whatever) REDIRECTSTDOUT(AliLog::kInfo, 0, ClassName(), whatever)
#define StderrToAliInfo(whatever) REDIRECTSTDERR(AliLog::kInfo, 0, ClassName(), whatever)
#define ToAliInfo(whatever) REDIRECTSTDOUTANDSTDERR(AliLog::kInfo, 0, ClassName(), whatever)
#define StdoutToAliInfoClass(whatever) REDIRECTSTDOUT(AliLog::kInfo, 0, Class()->GetName(), whatever)
#define StderrToAliInfoClass(whatever) REDIRECTSTDERR(AliLog::kInfo, 0, Class()->GetName(), whatever)
#define ToAliInfoClass(whatever) REDIRECTSTDOUTANDSTDERR(AliLog::kInfo, 0, Class()->GetName(), whatever)
#define StdoutToAliInfoGeneral(scope, whatever) REDIRECTSTDOUT(AliLog::kInfo, 0, scope, whatever)
#define StderrToAliInfoGeneral(scope, whatever) REDIRECTSTDERR(AliLog::kInfo, 0, scope, whatever)
#define ToAliInfoGeneral(scope, whatever) REDIRECTSTDOUTANDSTDERR(AliLog::kInfo, 0, scope, whatever)

// info stream objects
#define AliInfoStream() AliLog::Stream(AliLog::kInfo, 0, MODULENAME(), ClassName(), FUNCTIONNAME(), __FILE__, __LINE__)
#define AliInfoClassStream() AliLog::Stream(AliLog::kInfo, 0, MODULENAME(), Class()->GetName(), FUNCTIONNAME(), __FILE__, __LINE__)
#define AliInfoGeneralStream(scope) AliLog::Stream(AliLog::kInfo, 0, MODULENAME(), scope, FUNCTIONNAME(), __FILE__, __LINE__)

// warning messages
#ifdef LOG_NO_WARNING
# define AliWarning(message) do { } while (false)
# define AliWarningClass(message) do { } while (false)
# define AliWarningGeneral(scope, message) do { } while (false)
# define AliWarningF(message,...) do { } while (false)
# define AliWarningClassF(message,...) do { } while (false)
# define AliWarningGeneralF(scope, message,...) do { } while (false)
#else
/**
 * Forwards to AliMessage with log level of AliLog::kWarning
 * @see AliMessage 
 */
# define AliWarning(message)               AliMessage(AliLog::kWarning, message)
/**
 * Forwards to AliMessageClass with log level of AliLog::kWarning
 * @see AliMessageClass 
 */
# define AliWarningClass(message)          AliMessageClass(AliLog::kWarning, message)
/**
 * Forwards to AliMessageGeneral with log level of AliLog::kWarning
 * @see AliMessageGeneral
 */
# define AliWarningGeneral(scope, message) AliMessageGeneral(scope, AliLog::kWarning, message)
/**
 * Forwards to AliMessageF with log level of AliLog::kWarning
 * @see AliMessageF 
 */
# define AliWarningF(message,...)               AliMessageF(AliLog::kWarning, message, __VA_ARGS__)
/**
 * Forwards to AliMessageClassF with log level of AliLog::kWarning
 * @see AliMessageClassF 
 */
# define AliWarningClassF(message,...)          AliMessageClassF(AliLog::kWarning, message, __VA_ARGS__)
/**
 * Forwards to AliMessageGeneralF with log level of AliLog::kWarning
 * @see AliMessageGeneralF
 */
# define AliWarningGeneralF(scope,message,...)  AliMessageGeneralF(scope, AliLog::kWarning, message, __VA_ARGS__)
#endif

// redirection to warning
#define StdoutToAliWarning(whatever) REDIRECTSTDOUT(AliLog::kWarning, 0, ClassName(), whatever)
#define StderrToAliWarning(whatever) REDIRECTSTDERR(AliLog::kWarning, 0, ClassName(), whatever)
#define ToAliWarning(whatever) REDIRECTSTDOUTANDSTDERR(AliLog::kWarning, 0, ClassName(), whatever)
#define StdoutToAliWarningClass(whatever) REDIRECTSTDOUT(AliLog::kWarning, 0, Class()->GetName(), whatever)
#define StderrToAliWarningClass(whatever) REDIRECTSTDERR(AliLog::kWarning, 0, Class()->GetName(), whatever)
#define ToAliWarningClass(whatever) REDIRECTSTDOUTANDSTDERR(AliLog::kWarning, 0, Class()->GetName(), whatever)
#define StdoutToAliWarningGeneral(scope, whatever) REDIRECTSTDOUT(AliLog::kWarning, 0, scope, whatever)
#define StderrToAliWarningGeneral(scope, whatever) REDIRECTSTDERR(AliLog::kWarning, 0, scope, whatever)
#define ToAliWarningGeneral(scope, whatever) REDIRECTSTDOUTANDSTDERR(AliLog::kWarning, 0, scope, whatever)

// warning stream objects
#define AliWarningStream() AliLog::Stream(AliLog::kWarning, 0, MODULENAME(), ClassName(), FUNCTIONNAME(), __FILE__, __LINE__)
#define AliWarningClassStream() AliLog::Stream(AliLog::kWarning, 0, MODULENAME(), Class()->GetName(), FUNCTIONNAME(), __FILE__, __LINE__)
#define AliWarningGeneralStream(scope) AliLog::Stream(AliLog::kWarning, 0, MODULENAME(), scope, FUNCTIONNAME(), __FILE__, __LINE__)


// error messages
/**
 * Forwards to AliMessage with log level of AliLog::kError
 * @see AliMessage 
 */
#define AliError(message)               AliMessage(AliLog::kError, message)
/**
 * Forwards to AliMessageClass with log level of AliLog::kError
 * @see AliMessageClass 
 */
#define AliErrorClass(message)          AliMessageClass(AliLog::kError, message)
/**
 * Forwards to AliMessageGeneral with log level of AliLog::kError
 * @see AliMessageGeneral
 */
#define AliErrorGeneral(scope, message) AliMessageGeneral(scope, AliLog::kError, message)
/**
 * Forwards to AliMessageF with log level of AliLog::kError
 * @see AliMessageF 
 */
#define AliErrorF(message,...)               AliMessageF(AliLog::kError, message, __VA_ARGS__)
/**
 * Forwards to AliMessageClassF with log level of AliLog::kError
 * @see AliMessageClassF 
 */
#define AliErrorClassF(message,...)          AliMessageClassF(AliLog::kError, message, __VA_ARGS__)
/**
 * Forwards to AliMessageGeneralF with log level of AliLog::kError
 * @see AliMessageGeneralF
 */
#define AliErrorGeneralF(scope,message,...)  AliMessageGeneralF(scope, AliLog::kError, message, __VA_ARGS__)

// redirection to error
#define StdoutToAliError(whatever) REDIRECTSTDOUT(AliLog::kError, 0, ClassName(), whatever)
#define StderrToAliError(whatever) REDIRECTSTDERR(AliLog::kError, 0, ClassName(), whatever)
#define ToAliError(whatever) REDIRECTSTDOUTANDSTDERR(AliLog::kError, 0, ClassName(), whatever)
#define StdoutToAliErrorClass(whatever) REDIRECTSTDOUT(AliLog::kError, 0, Class()->GetName(), whatever)
#define StderrToAliErrorClass(whatever) REDIRECTSTDERR(AliLog::kError, 0, Class()->GetName(), whatever)
#define ToAliErrorClass(whatever) REDIRECTSTDOUTANDSTDERR(AliLog::kError, 0, Class()->GetName(), whatever)
#define StdoutToAliErrorGeneral(scope, whatever) REDIRECTSTDOUT(AliLog::kError, 0, scope, whatever)
#define StderrToAliErrorGeneral(scope, whatever) REDIRECTSTDERR(AliLog::kError, 0, scope, whatever)
#define ToAliErrorGeneral(scope, whatever) REDIRECTSTDOUTANDSTDERR(AliLog::kError, 0, scope, whatever)

// error stream objects
#define AliErrorStream() AliLog::Stream(AliLog::kError, 0, MODULENAME(), ClassName(), FUNCTIONNAME(), __FILE__, __LINE__)
#define AliErrorClassStream() AliLog::Stream(AliLog::kError, 0, MODULENAME(), Class()->GetName(), FUNCTIONNAME(), __FILE__, __LINE__)
#define AliErrorGeneralStream(scope) AliLog::Stream(AliLog::kError, 0, MODULENAME(), scope, FUNCTIONNAME(), __FILE__, __LINE__)


// fatal messages
/**
 * Forwards to AliMessage with log level of AliLog::kFatal
 * @see AliMessage 
 */
#define AliFatal(message)               AliMessage(AliLog::kFatal, message)
/**
 * Forwards to AliMessageClass with log level of AliLog::kFatal
 * @see AliMessageClass 
 */
#define AliFatalClass(message)          AliMessageClass(AliLog::kFatal, message)
/**
 * Forwards to AliMessageGeneral with log level of AliLog::kFatal
 * @see AliMessageGeneral
 */
#define AliFatalGeneral(scope, message) AliMessageGeneral(scope, AliLog::kFatal, message)
/**
 * Forwards to AliMessageF with log level of AliLog::kFatal
 * @see AliMessageF 
 */
#define AliFatalF(message,...)               AliMessageF(AliLog::kFatal, message, __VA_ARGS__)
/**
 * Forwards to AliMessageClassF with log level of AliLog::kFatal
 * @see AliMessageClassF 
 */
#define AliFatalClassF(message,...)          AliMessageClassF(AliLog::kFatal, message, __VA_ARGS__)
/**
 * Forwards to AliMessageGeneralF with log level of AliLog::kFatal
 * @see AliMessageGeneralF
 */
#define AliFatalGeneralF(scope,message,...)  AliMessageGeneralF(scope, AliLog::kFatal, message, __VA_ARGS__)

#endif
 AliLog.h:1
 AliLog.h:2
 AliLog.h:3
 AliLog.h:4
 AliLog.h:5
 AliLog.h:6
 AliLog.h:7
 AliLog.h:8
 AliLog.h:9
 AliLog.h:10
 AliLog.h:11
 AliLog.h:12
 AliLog.h:13
 AliLog.h:14
 AliLog.h:15
 AliLog.h:16
 AliLog.h:17
 AliLog.h:18
 AliLog.h:19
 AliLog.h:20
 AliLog.h:21
 AliLog.h:22
 AliLog.h:23
 AliLog.h:24
 AliLog.h:25
 AliLog.h:26
 AliLog.h:27
 AliLog.h:28
 AliLog.h:29
 AliLog.h:30
 AliLog.h:31
 AliLog.h:32
 AliLog.h:33
 AliLog.h:34
 AliLog.h:35
 AliLog.h:36
 AliLog.h:37
 AliLog.h:38
 AliLog.h:39
 AliLog.h:40
 AliLog.h:41
 AliLog.h:42
 AliLog.h:43
 AliLog.h:44
 AliLog.h:45
 AliLog.h:46
 AliLog.h:47
 AliLog.h:48
 AliLog.h:49
 AliLog.h:50
 AliLog.h:51
 AliLog.h:52
 AliLog.h:53
 AliLog.h:54
 AliLog.h:55
 AliLog.h:56
 AliLog.h:57
 AliLog.h:58
 AliLog.h:59
 AliLog.h:60
 AliLog.h:61
 AliLog.h:62
 AliLog.h:63
 AliLog.h:64
 AliLog.h:65
 AliLog.h:66
 AliLog.h:67
 AliLog.h:68
 AliLog.h:69
 AliLog.h:70
 AliLog.h:71
 AliLog.h:72
 AliLog.h:73
 AliLog.h:74
 AliLog.h:75
 AliLog.h:76
 AliLog.h:77
 AliLog.h:78
 AliLog.h:79
 AliLog.h:80
 AliLog.h:81
 AliLog.h:82
 AliLog.h:83
 AliLog.h:84
 AliLog.h:85
 AliLog.h:86
 AliLog.h:87
 AliLog.h:88
 AliLog.h:89
 AliLog.h:90
 AliLog.h:91
 AliLog.h:92
 AliLog.h:93
 AliLog.h:94
 AliLog.h:95
 AliLog.h:96
 AliLog.h:97
 AliLog.h:98
 AliLog.h:99
 AliLog.h:100
 AliLog.h:101
 AliLog.h:102
 AliLog.h:103
 AliLog.h:104
 AliLog.h:105
 AliLog.h:106
 AliLog.h:107
 AliLog.h:108
 AliLog.h:109
 AliLog.h:110
 AliLog.h:111
 AliLog.h:112
 AliLog.h:113
 AliLog.h:114
 AliLog.h:115
 AliLog.h:116
 AliLog.h:117
 AliLog.h:118
 AliLog.h:119
 AliLog.h:120
 AliLog.h:121
 AliLog.h:122
 AliLog.h:123
 AliLog.h:124
 AliLog.h:125
 AliLog.h:126
 AliLog.h:127
 AliLog.h:128
 AliLog.h:129
 AliLog.h:130
 AliLog.h:131
 AliLog.h:132
 AliLog.h:133
 AliLog.h:134
 AliLog.h:135
 AliLog.h:136
 AliLog.h:137
 AliLog.h:138
 AliLog.h:139
 AliLog.h:140
 AliLog.h:141
 AliLog.h:142
 AliLog.h:143
 AliLog.h:144
 AliLog.h:145
 AliLog.h:146
 AliLog.h:147
 AliLog.h:148
 AliLog.h:149
 AliLog.h:150
 AliLog.h:151
 AliLog.h:152
 AliLog.h:153
 AliLog.h:154
 AliLog.h:155
 AliLog.h:156
 AliLog.h:157
 AliLog.h:158
 AliLog.h:159
 AliLog.h:160
 AliLog.h:161
 AliLog.h:162
 AliLog.h:163
 AliLog.h:164
 AliLog.h:165
 AliLog.h:166
 AliLog.h:167
 AliLog.h:168
 AliLog.h:169
 AliLog.h:170
 AliLog.h:171
 AliLog.h:172
 AliLog.h:173
 AliLog.h:174
 AliLog.h:175
 AliLog.h:176
 AliLog.h:177
 AliLog.h:178
 AliLog.h:179
 AliLog.h:180
 AliLog.h:181
 AliLog.h:182
 AliLog.h:183
 AliLog.h:184
 AliLog.h:185
 AliLog.h:186
 AliLog.h:187
 AliLog.h:188
 AliLog.h:189
 AliLog.h:190
 AliLog.h:191
 AliLog.h:192
 AliLog.h:193
 AliLog.h:194
 AliLog.h:195
 AliLog.h:196
 AliLog.h:197
 AliLog.h:198
 AliLog.h:199
 AliLog.h:200
 AliLog.h:201
 AliLog.h:202
 AliLog.h:203
 AliLog.h:204
 AliLog.h:205
 AliLog.h:206
 AliLog.h:207
 AliLog.h:208
 AliLog.h:209
 AliLog.h:210
 AliLog.h:211
 AliLog.h:212
 AliLog.h:213
 AliLog.h:214
 AliLog.h:215
 AliLog.h:216
 AliLog.h:217
 AliLog.h:218
 AliLog.h:219
 AliLog.h:220
 AliLog.h:221
 AliLog.h:222
 AliLog.h:223
 AliLog.h:224
 AliLog.h:225
 AliLog.h:226
 AliLog.h:227
 AliLog.h:228
 AliLog.h:229
 AliLog.h:230
 AliLog.h:231
 AliLog.h:232
 AliLog.h:233
 AliLog.h:234
 AliLog.h:235
 AliLog.h:236
 AliLog.h:237
 AliLog.h:238
 AliLog.h:239
 AliLog.h:240
 AliLog.h:241
 AliLog.h:242
 AliLog.h:243
 AliLog.h:244
 AliLog.h:245
 AliLog.h:246
 AliLog.h:247
 AliLog.h:248
 AliLog.h:249
 AliLog.h:250
 AliLog.h:251
 AliLog.h:252
 AliLog.h:253
 AliLog.h:254
 AliLog.h:255
 AliLog.h:256
 AliLog.h:257
 AliLog.h:258
 AliLog.h:259
 AliLog.h:260
 AliLog.h:261
 AliLog.h:262
 AliLog.h:263
 AliLog.h:264
 AliLog.h:265
 AliLog.h:266
 AliLog.h:267
 AliLog.h:268
 AliLog.h:269
 AliLog.h:270
 AliLog.h:271
 AliLog.h:272
 AliLog.h:273
 AliLog.h:274
 AliLog.h:275
 AliLog.h:276
 AliLog.h:277
 AliLog.h:278
 AliLog.h:279
 AliLog.h:280
 AliLog.h:281
 AliLog.h:282
 AliLog.h:283
 AliLog.h:284
 AliLog.h:285
 AliLog.h:286
 AliLog.h:287
 AliLog.h:288
 AliLog.h:289
 AliLog.h:290
 AliLog.h:291
 AliLog.h:292
 AliLog.h:293
 AliLog.h:294
 AliLog.h:295
 AliLog.h:296
 AliLog.h:297
 AliLog.h:298
 AliLog.h:299
 AliLog.h:300
 AliLog.h:301
 AliLog.h:302
 AliLog.h:303
 AliLog.h:304
 AliLog.h:305
 AliLog.h:306
 AliLog.h:307
 AliLog.h:308
 AliLog.h:309
 AliLog.h:310
 AliLog.h:311
 AliLog.h:312
 AliLog.h:313
 AliLog.h:314
 AliLog.h:315
 AliLog.h:316
 AliLog.h:317
 AliLog.h:318
 AliLog.h:319
 AliLog.h:320
 AliLog.h:321
 AliLog.h:322
 AliLog.h:323
 AliLog.h:324
 AliLog.h:325
 AliLog.h:326
 AliLog.h:327
 AliLog.h:328
 AliLog.h:329
 AliLog.h:330
 AliLog.h:331
 AliLog.h:332
 AliLog.h:333
 AliLog.h:334
 AliLog.h:335
 AliLog.h:336
 AliLog.h:337
 AliLog.h:338
 AliLog.h:339
 AliLog.h:340
 AliLog.h:341
 AliLog.h:342
 AliLog.h:343
 AliLog.h:344
 AliLog.h:345
 AliLog.h:346
 AliLog.h:347
 AliLog.h:348
 AliLog.h:349
 AliLog.h:350
 AliLog.h:351
 AliLog.h:352
 AliLog.h:353
 AliLog.h:354
 AliLog.h:355
 AliLog.h:356
 AliLog.h:357
 AliLog.h:358
 AliLog.h:359
 AliLog.h:360
 AliLog.h:361
 AliLog.h:362
 AliLog.h:363
 AliLog.h:364
 AliLog.h:365
 AliLog.h:366
 AliLog.h:367
 AliLog.h:368
 AliLog.h:369
 AliLog.h:370
 AliLog.h:371
 AliLog.h:372
 AliLog.h:373
 AliLog.h:374
 AliLog.h:375
 AliLog.h:376
 AliLog.h:377
 AliLog.h:378
 AliLog.h:379
 AliLog.h:380
 AliLog.h:381
 AliLog.h:382
 AliLog.h:383
 AliLog.h:384
 AliLog.h:385
 AliLog.h:386
 AliLog.h:387
 AliLog.h:388
 AliLog.h:389
 AliLog.h:390
 AliLog.h:391
 AliLog.h:392
 AliLog.h:393
 AliLog.h:394
 AliLog.h:395
 AliLog.h:396
 AliLog.h:397
 AliLog.h:398
 AliLog.h:399
 AliLog.h:400
 AliLog.h:401
 AliLog.h:402
 AliLog.h:403
 AliLog.h:404
 AliLog.h:405
 AliLog.h:406
 AliLog.h:407
 AliLog.h:408
 AliLog.h:409
 AliLog.h:410
 AliLog.h:411
 AliLog.h:412
 AliLog.h:413
 AliLog.h:414
 AliLog.h:415
 AliLog.h:416
 AliLog.h:417
 AliLog.h:418
 AliLog.h:419
 AliLog.h:420
 AliLog.h:421
 AliLog.h:422
 AliLog.h:423
 AliLog.h:424
 AliLog.h:425
 AliLog.h:426
 AliLog.h:427
 AliLog.h:428
 AliLog.h:429
 AliLog.h:430
 AliLog.h:431
 AliLog.h:432
 AliLog.h:433
 AliLog.h:434
 AliLog.h:435
 AliLog.h:436
 AliLog.h:437
 AliLog.h:438
 AliLog.h:439
 AliLog.h:440
 AliLog.h:441
 AliLog.h:442
 AliLog.h:443
 AliLog.h:444
 AliLog.h:445
 AliLog.h:446
 AliLog.h:447
 AliLog.h:448
 AliLog.h:449
 AliLog.h:450
 AliLog.h:451
 AliLog.h:452
 AliLog.h:453
 AliLog.h:454
 AliLog.h:455
 AliLog.h:456
 AliLog.h:457
 AliLog.h:458
 AliLog.h:459
 AliLog.h:460
 AliLog.h:461
 AliLog.h:462
 AliLog.h:463
 AliLog.h:464
 AliLog.h:465
 AliLog.h:466
 AliLog.h:467
 AliLog.h:468
 AliLog.h:469
 AliLog.h:470
 AliLog.h:471
 AliLog.h:472
 AliLog.h:473
 AliLog.h:474
 AliLog.h:475
 AliLog.h:476
 AliLog.h:477
 AliLog.h:478
 AliLog.h:479
 AliLog.h:480
 AliLog.h:481
 AliLog.h:482
 AliLog.h:483
 AliLog.h:484
 AliLog.h:485
 AliLog.h:486
 AliLog.h:487
 AliLog.h:488
 AliLog.h:489
 AliLog.h:490
 AliLog.h:491
 AliLog.h:492
 AliLog.h:493
 AliLog.h:494
 AliLog.h:495
 AliLog.h:496
 AliLog.h:497
 AliLog.h:498
 AliLog.h:499
 AliLog.h:500
 AliLog.h:501
 AliLog.h:502
 AliLog.h:503
 AliLog.h:504
 AliLog.h:505
 AliLog.h:506
 AliLog.h:507
 AliLog.h:508
 AliLog.h:509
 AliLog.h:510
 AliLog.h:511
 AliLog.h:512
 AliLog.h:513
 AliLog.h:514
 AliLog.h:515
 AliLog.h:516
 AliLog.h:517
 AliLog.h:518
 AliLog.h:519
 AliLog.h:520
 AliLog.h:521
 AliLog.h:522
 AliLog.h:523
 AliLog.h:524
 AliLog.h:525
 AliLog.h:526
 AliLog.h:527
 AliLog.h:528
 AliLog.h:529
 AliLog.h:530
 AliLog.h:531
 AliLog.h:532
 AliLog.h:533
 AliLog.h:534
 AliLog.h:535
 AliLog.h:536
 AliLog.h:537
 AliLog.h:538
 AliLog.h:539
 AliLog.h:540
 AliLog.h:541
 AliLog.h:542
 AliLog.h:543
 AliLog.h:544
 AliLog.h:545
 AliLog.h:546
 AliLog.h:547
 AliLog.h:548
 AliLog.h:549
 AliLog.h:550
 AliLog.h:551
 AliLog.h:552
 AliLog.h:553
 AliLog.h:554
 AliLog.h:555
 AliLog.h:556
 AliLog.h:557
 AliLog.h:558
 AliLog.h:559
 AliLog.h:560
 AliLog.h:561
 AliLog.h:562
 AliLog.h:563
 AliLog.h:564
 AliLog.h:565
 AliLog.h:566
 AliLog.h:567
 AliLog.h:568
 AliLog.h:569
 AliLog.h:570
 AliLog.h:571
 AliLog.h:572
 AliLog.h:573
 AliLog.h:574
 AliLog.h:575
 AliLog.h:576
 AliLog.h:577
 AliLog.h:578
 AliLog.h:579
 AliLog.h:580
 AliLog.h:581
 AliLog.h:582
 AliLog.h:583
 AliLog.h:584
 AliLog.h:585
 AliLog.h:586
 AliLog.h:587
 AliLog.h:588
 AliLog.h:589
 AliLog.h:590
 AliLog.h:591
 AliLog.h:592
 AliLog.h:593
 AliLog.h:594
 AliLog.h:595
 AliLog.h:596
 AliLog.h:597
 AliLog.h:598
 AliLog.h:599
 AliLog.h:600
 AliLog.h:601
 AliLog.h:602
 AliLog.h:603
 AliLog.h:604
 AliLog.h:605
 AliLog.h:606
 AliLog.h:607
 AliLog.h:608
 AliLog.h:609
 AliLog.h:610
 AliLog.h:611
 AliLog.h:612
 AliLog.h:613
 AliLog.h:614
 AliLog.h:615
 AliLog.h:616
 AliLog.h:617
 AliLog.h:618
 AliLog.h:619
 AliLog.h:620
 AliLog.h:621
 AliLog.h:622
 AliLog.h:623
 AliLog.h:624
 AliLog.h:625
 AliLog.h:626
 AliLog.h:627
 AliLog.h:628
 AliLog.h:629
 AliLog.h:630
 AliLog.h:631
 AliLog.h:632
 AliLog.h:633
 AliLog.h:634
 AliLog.h:635
 AliLog.h:636
 AliLog.h:637
 AliLog.h:638
 AliLog.h:639
 AliLog.h:640
 AliLog.h:641
 AliLog.h:642
 AliLog.h:643
 AliLog.h:644
 AliLog.h:645
 AliLog.h:646
 AliLog.h:647
 AliLog.h:648
 AliLog.h:649
 AliLog.h:650
 AliLog.h:651
 AliLog.h:652
 AliLog.h:653
 AliLog.h:654
 AliLog.h:655
 AliLog.h:656
 AliLog.h:657
 AliLog.h:658
 AliLog.h:659
 AliLog.h:660
 AliLog.h:661
 AliLog.h:662
 AliLog.h:663
 AliLog.h:664
 AliLog.h:665
 AliLog.h:666
 AliLog.h:667