gtestMessenger.cxx
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*!
3 
4 \program gtestMessenger
5 
6 \brief Program used for testing / debugging log4cpp
7 
8 \author Costas Andreopoulos <constantinos.andreopoulos \at cern.ch>
9  University of Liverpool & STFC Rutherford Appleton Laboratory
10 
11 \created June 10, 2004
12 
13 \cpright Copyright (c) 2003-2020, The GENIE Collaboration
14  For the full text of the license visit http://copyright.genie-mc.org
15 
16 */
17 //____________________________________________________________________________
18 
20 
21 using namespace genie;
22 
23 int main(int /*argc*/, char ** /*argv*/)
24 {
25  LOG("Stream-Name", pFATAL) << "this is a message with priority: FATAL" ;
26  LOG("Stream-Name", pALERT) << "this is a message with priority: ALERT" ;
27  LOG("Stream-Name", pCRIT) << "this is a message with priority: CRIT" ;
28  LOG("Stream-Name", pERROR) << "this is a message with priority: ERROR" ;
29  LOG("Stream-Name", pWARN) << "this is a message with priority: WARN" ;
30  LOG("Stream-Name", pNOTICE) << "this is a message with priority: NOTICE";
31  LOG("Stream-Name", pINFO) << "this is a message with priority: INFO" ;
32  LOG("Stream-Name", pDEBUG) << "this is a message with priority: DEBUG" ;
33 
34  //-- set a "verbosity level" for the "Stream-Name" message stream
35 
37  msg->SetPriorityLevel("Stream-Name", pERROR);
38 
39  //-- re-print / some of them must be filtered now
40 
41  LOG("Stream-Name", pFATAL) << "this is another message with priority: FATAL" ;
42  LOG("Stream-Name", pALERT) << "this is another message with priority: ALERT" ;
43  LOG("Stream-Name", pCRIT) << "this is another message with priority: CRIT" ;
44  LOG("Stream-Name", pERROR) << "this is another message with priority: ERROR" ;
45  LOG("Stream-Name", pWARN) << "this is another message with priority: WARN" ;
46  LOG("Stream-Name", pNOTICE) << "this is another message with priority: NOTICE";
47  LOG("Stream-Name", pINFO) << "this is another message with priority: INFO" ;
48  LOG("Stream-Name", pDEBUG) << "this is another message with priority: DEBUG" ;
49 
50  //-- set pririty level to minimum
51 
52  msg->SetPriorityLevel("Stream-Name", pDEBUG);
53 
54  //-- try different pre-processor macros for printing out messages
55 
56  LOG_FATAL ("Stream-Name") << "this is yet another message with priority: FATAL" ;
57  LOG_ALERT ("Stream-Name") << "this is yet another message with priority: ALERT" ;
58  LOG_CRIT ("Stream-Name") << "this is yet another message with priority: CRIT" ;
59  LOG_ERROR ("Stream-Name") << "this is yet another message with priority: ERROR" ;
60  LOG_WARN ("Stream-Name") << "this is yet another message with priority: WARN" ;
61  LOG_NOTICE ("Stream-Name") << "this is yet another message with priority: NOTICE";
62  LOG_INFO ("Stream-Name") << "this is yet another message with priority: INFO" ;
63  LOG_DEBUG ("Stream-Name") << "this is yet another message with priority: DEBUG" ;
64 
65  return 0;
66 }
67 
#define LOG_DEBUG(stream)
Definition: Messenger.h:147
#define LOG_FATAL(stream)
Definition: Messenger.h:112
THE MAIN GENIE PROJECT NAMESPACE
Definition: AlgCmp.h:25
#define pERROR
Definition: Messenger.h:59
void msg(const char *fmt,...)
Definition: message.cpp:107
#define pFATAL
Definition: Messenger.h:56
#define LOG_WARN(stream)
Definition: Messenger.h:132
#define LOG_CRIT(stream)
Definition: Messenger.h:122
#define pALERT
Definition: Messenger.h:57
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
static Messenger * Instance(void)
Definition: Messenger.cxx:49
#define pINFO
Definition: Messenger.h:62
#define LOG_ALERT(stream)
Definition: Messenger.h:117
int main(int, char **)
#define pWARN
Definition: Messenger.h:60
A more convenient interface to the log4cpp Message Service.
Definition: Messenger.h:258
void SetPriorityLevel(const char *stream, log4cpp::Priority::Value p)
Definition: Messenger.cxx:88
#define LOG_NOTICE(stream)
Definition: Messenger.h:137
#define pNOTICE
Definition: Messenger.h:61
#define LOG_INFO(stream)
Definition: Messenger.h:142
#define pCRIT
Definition: Messenger.h:58
#define LOG_ERROR(stream)
Definition: Messenger.h:127
#define pDEBUG
Definition: Messenger.h:63