File indexing completed on 2024-04-06 12:07:28
0001 #ifndef Logger_h
0002 #define Logger_h
0003
0004 #include "DQM/HcalCommon/interface/HcalCommonHeaders.h"
0005
0006 class Logger {
0007 public:
0008 Logger(std::string const &name, int debug = 0) : _name(name), _debug(debug) {}
0009 Logger() {}
0010 virtual ~Logger() {}
0011
0012 inline void dqmthrow(std::string const &msg) const { throw cms::Exception("HCALDQM") << _name << "::" << msg; }
0013 inline void warn(std::string const &msg) const { edm::LogWarning("HCALDQM") << _name << "::" << msg; }
0014 inline void info(std::string const &msg) const {
0015 if (_debug == 0)
0016 return;
0017 edm::LogInfo("HCALDQM") << _name << "::" << msg;
0018 }
0019 template <typename STDTYPE>
0020 inline void debug(STDTYPE const &msg) const {
0021 if (_debug == 0)
0022 return;
0023
0024 std::cout << "%MSG" << std::endl;
0025 std::cout << "$MSG-d HCALDQM::" << _name << "::" << msg;
0026 std::cout << std::endl;
0027 }
0028
0029 inline void set(std::string const &name, int debug = 0) {
0030 _name = name;
0031 _debug = debug;
0032
0033 if (debug == 0)
0034 return;
0035
0036 this->debug("Setting up Logger for " + _name);
0037 }
0038
0039 protected:
0040 std::string _name;
0041 int _debug;
0042 };
0043
0044 #endif