BAT  0.9.4
The Bayesian analysis toolkit
 All Classes Namespaces Functions Variables Enumerations
BCLog.h
1 #ifndef __BCLOG__H
2 #define __BCLOG__H
3 
15 /*
16  * Copyright (C) 2007-2014, the BAT core developer team
17  * All rights reserved.
18  *
19  * For the licensing terms see doc/COPYING.
20  * For documentation see http://mpp.mpg.de/bat
21  */
22 
23 // ---------------------------------------------------------
24 
25 #include <iostream>
26 
27 // ---------------------------------------------------------
28 
29 class BCLog
30 {
31  public:
32 
33  // definition of log level
34 
45  enum LogLevel {debug, detail, summary, warning, error, nothing};
46 
52  BCLog();
53 
56  ~BCLog();
57 
66  { return fMinimumLogLevelFile; };
67 
72  { return fMinimumLogLevelScreen; };
73 
81  static void SetLogLevelFile(BCLog::LogLevel loglevel)
82  { BCLog::fMinimumLogLevelFile = loglevel; };
83 
87  static void SetLogLevelScreen(BCLog::LogLevel loglevel)
88  { BCLog::fMinimumLogLevelScreen = loglevel; };
89 
94  static void SetLogLevel(BCLog::LogLevel loglevelscreen, BCLog::LogLevel loglevelfile)
95  { BCLog::fMinimumLogLevelFile = loglevelfile; BCLog::fMinimumLogLevelScreen = loglevelscreen; };
96 
100  static void SetLogLevel(BCLog::LogLevel loglevel)
101  { SetLogLevel(loglevel, loglevel); };
102 
112  static void OpenLog(const char * filename, BCLog::LogLevel loglevelfile, BCLog::LogLevel loglevelscreen);
113 
114  static void OpenLog(const char * filename);
115 
116  static void OpenLog();
117 
120  static bool IsOpen();
121 
124  static void CloseLog();
125 
131  static void Out(BCLog::LogLevel loglevelfile, BCLog::LogLevel loglevelscreen, const char * message);
132 
133  static void Out(const char * message);
134 
135  static void Out(BCLog::LogLevel loglevel, const char * message)
136  { Out(loglevel,loglevel,message); };
137 
138  static void OutError(const char * message)
139  { Out(error,message); };
140 
141  static void OutWarning(const char * message)
142  { Out(warning,message); };
143 
144  static void OutSummary(const char * message)
145  { Out(summary,message); };
146 
147  static void OutDetail(const char * message)
148  { Out(detail,message); };
149 
150  static void OutDebug(const char * message)
151  { Out(debug,message); };
152 
155  static void StartupInfo();
156 
159  static const char * GetVersion()
160  { return fVersion; };
161 
164  static int GetHIndex()
165  { return BCLog::fHindex++; };
166 
169  static const char * ToString(BCLog::LogLevel);
170 
172  private:
173 
176  static const char * fVersion;
177 
180  static BCLog::LogLevel fMinimumLogLevelFile;
181 
184  static BCLog::LogLevel fMinimumLogLevelScreen;
185 
188  static std::ofstream fOutputStream;
189 
192  static bool fFirstOutputDone;
193 
196  static int fHindex;
197 };
198 
199 // ---------------------------------------------------------
200 
201 #endif
static BCLog::LogLevel GetLogLevelFile()
Definition: BCLog.h:65
static void SetLogLevel(BCLog::LogLevel loglevelscreen, BCLog::LogLevel loglevelfile)
Definition: BCLog.h:94
static bool IsOpen()
Definition: BCLog.cxx:86
static void SetLogLevel(BCLog::LogLevel loglevel)
Definition: BCLog.h:100
LogLevel
Definition: BCLog.h:45
static int GetHIndex()
Definition: BCLog.h:164
static void CloseLog()
Definition: BCLog.cxx:93
static void SetLogLevelFile(BCLog::LogLevel loglevel)
Definition: BCLog.h:81
BCLog()
Definition: BCLog.cxx:36
static void StartupInfo()
Definition: BCLog.cxx:128
static const char * GetVersion()
Definition: BCLog.h:159
static void Out(BCLog::LogLevel loglevelfile, BCLog::LogLevel loglevelscreen, const char *message)
Definition: BCLog.cxx:100
static void SetLogLevelScreen(BCLog::LogLevel loglevel)
Definition: BCLog.h:87
static const char * ToString(BCLog::LogLevel)
Definition: BCLog.cxx:155
~BCLog()
Definition: BCLog.cxx:44
static BCLog::LogLevel GetLogLevelScreen()
Definition: BCLog.h:71
A class for managing log messages.
Definition: BCLog.h:29