CMS 3D CMS Logo

Logger.h
Go to the documentation of this file.
1 #ifndef Logger_h
2 #define Logger_h
3 
5 
6 class Logger {
7 public:
8  Logger(std::string const &name, int debug = 0) : _name(name), _debug(debug) {}
9  Logger() {}
10  virtual ~Logger() {}
11 
12  inline void dqmthrow(std::string const &msg) const { throw cms::Exception("HCALDQM") << _name << "::" << msg; }
13  inline void warn(std::string const &msg) const { edm::LogWarning("HCALDQM") << _name << "::" << msg; }
14  inline void info(std::string const &msg) const {
15  if (_debug == 0)
16  return;
17  edm::LogInfo("HCALDQM") << _name << "::" << msg;
18  }
19  template <typename STDTYPE>
20  inline void debug(STDTYPE const &msg) const {
21  if (_debug == 0)
22  return;
23 
24  std::cout << "%MSG" << std::endl;
25  std::cout << "$MSG-d HCALDQM::" << _name << "::" << msg;
26  std::cout << std::endl;
27  }
28 
29  inline void set(std::string const &name, int debug = 0) {
30  _name = name;
31  _debug = debug;
32 
33  if (debug == 0)
34  return;
35 
36  this->debug("Setting up Logger for " + _name);
37  }
38 
39 protected:
41  int _debug;
42 };
43 
44 #endif
Definition: Logger.h:6
void warn(std::string const &msg) const
Definition: Logger.h:13
int _debug
Definition: Logger.h:41
virtual ~Logger()
Definition: Logger.h:10
void debug(STDTYPE const &msg) const
Definition: Logger.h:20
void info(std::string const &msg) const
Definition: Logger.h:14
Logger()
Definition: Logger.h:9
void dqmthrow(std::string const &msg) const
Definition: Logger.h:12
std::string _name
Definition: Logger.h:40
tuple msg
Definition: mps_check.py:279
Logger(std::string const &name, int debug=0)
Definition: Logger.h:8