GGS(GenericGEANT4Simulation)Software  2.6.3
 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 <iostream>
14 #include <iomanip>
15 
16 namespace GGSSmartLog {
24 enum {
25  SILENT, ERROR, WARNING, INFO, DEBUG, DEEPDEB
26 };
27 extern const char *levelNames[6];
28 extern int verboseLevel;
29 extern int maxRoutineNameLength;
30 
40 extern const std::string& Format(const std::string &str, unsigned int maxLength);
41 
46 extern void MuteOutput();
47 
52 void UnmuteOutput();
53 }
54 
77 #define COUT(level) \
78  if (GGSSmartLog::verboseLevel >= GGSSmartLog::level) \
79  std::cout << std::setw(GGSSmartLog::maxRoutineNameLength + 3) << std::left << std::string("[").append(GGSSmartLog::Format(routineName, GGSSmartLog::maxRoutineNameLength)).append("] ") \
80  << std::setw(10) << GGSSmartLog::levelNames[GGSSmartLog::level]
81 
99 #define CCOUT(level) \
100  if (GGSSmartLog::verboseLevel >= GGSSmartLog::level) \
101  std::cout << std::setw(GGSSmartLog::maxRoutineNameLength + 13) << " "
102 
104 #define ENDL std::endl
105 
106 #endif /* GGSSMARTLOG_H_ */