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 <costas.andreopoulos \at stfc.ac.uk>
9  University of Liverpool & STFC Rutherford Appleton Lab
10 
11 \created June 10, 2004
12 
13 \cpright Copyright (c) 2003-2016, GENIE Neutrino MC Generator Collaboration
14  For the full text of the license visit http://copyright.genie-mc.org
15  or see $GENIE/LICENSE
16 */
17 //____________________________________________________________________________
18 
19 #include "Messenger/Messenger.h"
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:149
#define LOG_FATAL(stream)
Definition: Messenger.h:114
THE MAIN GENIE PROJECT NAMESPACE
Definition: GeneratorBase.h:8
#define pERROR
Definition: Messenger.h:60
#define pFATAL
Definition: Messenger.h:57
#define LOG_WARN(stream)
Definition: Messenger.h:134
#define LOG_CRIT(stream)
Definition: Messenger.h:124
#define pALERT
Definition: Messenger.h:58
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
static Messenger * Instance(void)
Definition: Messenger.cxx:71
#define pINFO
Definition: Messenger.h:63
#define LOG_ALERT(stream)
Definition: Messenger.h:119
int main(int, char **)
#define pWARN
Definition: Messenger.h:61
A more convenient interface to the log4cpp Message Service.
Definition: Messenger.h:261
void SetPriorityLevel(const char *stream, log4cpp::Priority::Value p)
Definition: Messenger.cxx:110
#define LOG_NOTICE(stream)
Definition: Messenger.h:139
#define pNOTICE
Definition: Messenger.h:62
#define LOG_INFO(stream)
Definition: Messenger.h:144
#define pCRIT
Definition: Messenger.h:59
#define LOG_ERROR(stream)
Definition: Messenger.h:129
#define pDEBUG
Definition: Messenger.h:64