GGS(GenericGEANT4Simulation)Software  2.6.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 <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 
42 }
43 
66 #define COUT(level) \
67  if (GGSSmartLog::verboseLevel >= GGSSmartLog::level) \
68  std::cout << std::setw(GGSSmartLog::maxRoutineNameLength + 3) << std::left << std::string("[").append(GGSSmartLog::Format(routineName, GGSSmartLog::maxRoutineNameLength)).append("] ") \
69  << std::setw(10) << GGSSmartLog::levelNames[GGSSmartLog::level]
70 
88 #define CCOUT(level) \
89  if (GGSSmartLog::verboseLevel >= GGSSmartLog::level) \
90  std::cout << std::setw(GGSSmartLog::maxRoutineNameLength + 13) << " "
91 
93 #define ENDL std::endl
94 
95 #endif /* GGSSMARTLOG_H_ */