ATLAS Offline Software
graphics/VP1/VP1Systems/VP1TriggerSystems/src/Logger.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 /***********************************************************************************
6  * @Package : VP1TriggerSystems
7  * @Class : Logger
8  *
9  * @brief : Trigger Messenger Service - common stdcout methods
10  *
11  * @author : Manuel Proissl <mproissl@cern.ch> - University of Edinburgh
12  ***********************************************************************************/
13 
14 //Local includes
16 
17 //Default Constructor (no class name specified)
18 //_____________________________________________________________________________________________
20  : m_name("VP1Trig::?"),m_lvl(0) {}
21 
22 
23 //Constructor call with class name
24 //_____________________________________________________________________________________________
25 VP1Trig::Logger::Logger(const std::string& name)
26  : m_name(name),m_lvl(1) {}
27 
28 
29 //Output methods without variables
30 //_____________________________________________________________________________________________
31 //--- output activated by user: level dependent --------------------->
32 void VP1Trig::Logger::log_info(const QString& msg) {
33  if(m_lvl>=1)
34  std::cout<<prefix(m_name)<<"INFO "<<msg.toStdString()<<std::endl;
35 }
36 void VP1Trig::Logger::log_warning(const QString& msg) {
37  if(m_lvl>=2)
38  std::cout<<prefix(m_name)<<"WARNING "<<msg.toStdString()<<std::endl;
39 }
40 void VP1Trig::Logger::log_verbose(const QString& msg) {
41  if(m_lvl>=3)
42  std::cout<<prefix(m_name)<<"VERBOSE "<<msg.toStdString()<<std::endl;
43 }
44 
45 //--- output always active: independet of level --------------------->
46 void VP1Trig::Logger::log_error(const QString& msg) {
47  std::cout<<prefix(m_name)<<"ERROR "<<msg.toStdString()<<std::endl;
48 }
49 void VP1Trig::Logger::log_fatal(const QString& msg) {
50  std::cout<<prefix(m_name)<<"FATAL "<<msg.toStdString()<<std::endl;
51 }
52 
53 //--- output can be only used by developers ------------------------->
54 void VP1Trig::Logger::log_debug(const QString& msg) {
55  std::cout<<prefix(m_name)<<"DEBUG "<<msg.toStdString()<<std::endl;
56 }
57 
58 
59 //Applying character prefix standard
60 //_____________________________________________________________________________________________
61 std::string VP1Trig::Logger::prefix(std::string str)
62 {
63  //15 character prefix standard
64  if(int(str.size())>15) {
65  str=str.substr(0,15);
66  str=str+std::string("... ");
67  return str;
68  }
69  else if(int(str.size())==15) {
70  str=str+std::string(" ");
71  return str;
72  }
73  int q=21-int(str.size());
74  for(int i=0;i<q;++i)
75  str=str+std::string(" ");
76  return str;
77 }
78 
79 
80 //VP1String addition for char variables
81 //_____________________________________________________________________________________________
82 QString VP1Trig::Logger::qstr(char c)
83 {
84  std::stringstream ss; ss<<c;
85  std::string cStr=ss.str();
86  ss.str(std::string()); ss.clear();
87  return QString::fromStdString(cStr);
88 }
89 
90 
91 //VP1String addition for std::string variables
92 //_____________________________________________________________________________________________
93 QString VP1Trig::Logger::qstr(std::string str)
94 {
95  return QString::fromStdString(str);
96 }
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
VP1Trig::Logger::log_verbose
void log_verbose(const QString &msg)
Definition: graphics/VP1/VP1Systems/VP1TriggerSystems/src/Logger.cxx:40
VP1Trig::Logger::log_fatal
void log_fatal(const QString &msg)
Definition: graphics/VP1/VP1Systems/VP1TriggerSystems/src/Logger.cxx:49
VP1Trig::Logger::log_warning
void log_warning(const QString &msg)
Definition: graphics/VP1/VP1Systems/VP1TriggerSystems/src/Logger.cxx:36
lumiFormat.i
int i
Definition: lumiFormat.py:92
Logger.h
VP1Trig::Logger::qstr
QString qstr(char c)
Definition: graphics/VP1/VP1Systems/VP1TriggerSystems/src/Logger.cxx:82
VP1Trig::Logger::log_debug
void log_debug(const QString &msg)
Definition: graphics/VP1/VP1Systems/VP1TriggerSystems/src/Logger.cxx:54
checkCorrelInHIST.prefix
dictionary prefix
Definition: checkCorrelInHIST.py:391
VP1Trig::Logger::log_error
void log_error(const QString &msg)
Definition: graphics/VP1/VP1Systems/VP1TriggerSystems/src/Logger.cxx:46
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
VP1Trig::Logger::log_info
void log_info(const QString &msg)
Definition: graphics/VP1/VP1Systems/VP1TriggerSystems/src/Logger.cxx:32
VP1Trig::Logger::prefix
std::string prefix(std::string str)
Definition: graphics/VP1/VP1Systems/VP1TriggerSystems/src/Logger.cxx:61
python.CaloScaleNoiseConfig.str
str
Definition: CaloScaleNoiseConfig.py:78
extractSporadic.q
list q
Definition: extractSporadic.py:98
str
Definition: BTagTrackIpAccessor.cxx:11
VP1Trig::Logger::Logger
Logger()
Definition: graphics/VP1/VP1Systems/VP1TriggerSystems/src/Logger.cxx:19
python.compressB64.c
def c
Definition: compressB64.py:93
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7