Scarab  v2.11.1
Project 8 C++ Utility Library
test_verbosity.cc
Go to the documentation of this file.
1 /*
2  * test_verbosity.cc
3  *
4  * Created on: Mar 31, 2020
5  * Author: N.S. Oblath
6  */
7 
8 #include "application.hh"
9 
10 using namespace scarab;
11 
12 LOGGER( tlog, "test_verbosity" );
13 
14 int main()
15 {
16  main_app t_app;
17 
18  // test default verbosity
19  LPROG( tlog, "Verbosity should be PROG (" << static_cast<unsigned>(logger::ELevel::eProg) << "): " << static_cast<unsigned>(tlog.GetLevel()) );
20 
21  // test increasing verbosity
22  t_app.increase_global_verbosity( 1 );
23  LINFO( tlog, "Verbosity should be INFO (" << static_cast<unsigned>(logger::ELevel::eInfo) << "): " << static_cast<unsigned>(tlog.GetLevel()) );
24 
25  // test increasing past the end
26  t_app.increase_global_verbosity( 10 );
27  LTRACE( tlog, "Verbosity should be TRACE (" << static_cast<unsigned>(logger::ELevel::eTrace) << "): " << static_cast<unsigned>(tlog.GetLevel()) );
28 
29  // test decreasing past the beginning
30  t_app.decrease_global_verbosity( 100 );
31  LFATAL( tlog, "Verbosity should be FATAL (" << static_cast<unsigned>(logger::ELevel::eFatal) << "): " << static_cast<unsigned>(tlog.GetLevel()) );
32 
33  // test setting verbosity
34  t_app.set_global_verbosity( 30 );
35  LWARN( tlog, "Verbosity should be WARN (" << static_cast<unsigned>(logger::ELevel::eWarn) << "): " << static_cast<unsigned>(tlog.GetLevel()) );
36 
37  // test decreasing past the beginning
38  t_app.set_global_verbosity( 100 );
39  LFATAL( tlog, "Verbosity should be FATAL (" << static_cast<unsigned>(logger::ELevel::eFatal) << "): " << static_cast<unsigned>(tlog.GetLevel()) );
40 
41  return 0;
42 }
43 
44 
#define LWARN(...)
Definition: logger.hh:381
void increase_global_verbosity(unsigned an_offset)
Definition: application.cc:210
void decrease_global_verbosity(unsigned an_offset)
Definition: application.cc:225
LOGGER(mtlog, "authentication")
void set_global_verbosity(verbosity_t a_verbosity)
Set the global verbosity with the verbosity value.
Definition: application.cc:185
#define LPROG(...)
Definition: logger.hh:380
#define LTRACE(...)
Definition: logger.hh:376
int main()
#define LINFO(...)
Definition: logger.hh:379
#define LFATAL(...)
Definition: logger.hh:383
Primary application class.
Definition: application.hh:256