]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/BASE/AliHLTLogging.h
base class for logging functions and configuration scheme created
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTLogging.h
1 // @(#) $Id: 
2
3 #ifndef ALIHLTLOGGING_H
4 #define ALIHLTLOGGING_H
5 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
6  * See cxx source for full Copyright notice                               */
7
8 /* AliHLTLogging
9    the HLT logging methods
10  */
11
12
13 #include "AliHLTDataTypes.h"
14 #include <TObject.h>
15 #include <stdio.h>
16
17 #define LOG_BUFFER_SIZE 100 // global logging buffer
18 #define LOG_PREFIX ""       // logging prefix, for later extensions
19
20 #define DebugMsg( ... ) LoggingVarargs(kHLTLogDebug, this->Class_Name() , __func__ ,  __VA_ARGS__ )
21
22 class AliHLTLogging {
23 public:
24   AliHLTLogging();
25   virtual ~AliHLTLogging();
26
27   /* logging filter for all objects
28    */
29   static AliHLTComponent_LogSeverity SetGlobalLogLevel(AliHLTComponent_LogSeverity iLogFilter) {fGlobalLogFilter=iLogFilter; return fGlobalLogFilter;}
30
31   /* logging filter for individual object
32    */
33   AliHLTComponent_LogSeverity SetLocalLogLevel(AliHLTComponent_LogSeverity iLogFilter) {fLocalLogFilter=iLogFilter; return fLocalLogFilter;}
34   
35   static int Init(fctLogging pFun) { fLoggingFunc=pFun; return 0;}
36
37   // genaral logging function
38   //
39   static int Logging( AliHLTComponent_LogSeverity severity, const char* origin, const char* keyword, const char* message, ... );
40
41   // logging function with two origin parameters, used by the log macros
42   //
43   int LoggingVarargs( AliHLTComponent_LogSeverity severity, const char* origin_class, const char* origin_func,  ... );
44
45   // apply filter, return 1 if message should pass
46   //
47   int CheckFilter(AliHLTComponent_LogSeverity severity);
48
49   static int Message(void * param, AliHLTComponent_LogSeverity severity, const char* origin, const char* keyword, const char* message);
50
51   static const char* BuildLogString(const char *format, va_list ap);
52
53   virtual void* GetParameter() {return NULL;}
54 protected:
55
56 private:
57   static  AliHLTComponent_LogSeverity fGlobalLogFilter;
58   AliHLTComponent_LogSeverity fLocalLogFilter;
59   static char fLogBuffer[LOG_BUFFER_SIZE];
60   static char fOriginBuffer[LOG_BUFFER_SIZE];
61   static fctLogging fLoggingFunc;
62
63   ClassDef(AliHLTLogging, 0)
64 };
65 #endif
66