GGS(GenericGEANT4Simulation)Software  2.7.0
 All Data Structures Namespaces Files Functions Variables Typedefs Macros
GGSSmartLog.h
Go to the documentation of this file.
1 /*
2  * GGSSmartLog.h
3  *
4  * Created on: 01 Jan 2014
5  * Author: Nicola Mori
6  */
7 
10 #ifndef GGSSMARTLOG_H_
11 #define GGSSMARTLOG_H_
12 
13 #include <iomanip>
14 #include <iostream>
15 
16 namespace GGSSmartLog {
24 enum { SILENT, ERROR, WARNING, INFO, DEBUG, DEEPDEB };
25 extern const char *levelNames[6];
26 extern int verboseLevel;
27 extern int maxRoutineNameLength;
28 
38 extern const std::string &Format(const std::string &str, unsigned int maxLength);
39 
44 extern void MuteOutput();
45 
50 void UnmuteOutput();
51 } // namespace GGSSmartLog
52 
76 #define COUT(level) \
77  if (GGSSmartLog::verboseLevel >= GGSSmartLog::level) \
78  std::cout \
79  << std::setw(GGSSmartLog::maxRoutineNameLength + 3) << std::left \
80  << std::string("[").append(GGSSmartLog::Format(routineName, GGSSmartLog::maxRoutineNameLength)).append("] ") \
81  << std::setw(10) << GGSSmartLog::levelNames[GGSSmartLog::level]
82 
100 #define CCOUT(level) \
101  if (GGSSmartLog::verboseLevel >= GGSSmartLog::level) \
102  std::cout << std::setw(GGSSmartLog::maxRoutineNameLength + 13) << " "
103 
105 #define ENDL std::endl
106 
107 #endif /* GGSSMARTLOG_H_ */