Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
jlog.cc
Go to the documentation of this file.
1 #include "log.hh"
2 
6 
7 /**
8  * \author cpellegrino
9  */
10 
11 using namespace JPP;
12 
13 class MLSing
14 {
15  MLSing() {}
16  JMessageLoggerThreadSafe m_mlts;
17 
18  public:
19 
20  static MLSing& get()
21  {
22  static MLSing sing;
23 
24  return sing;
25  }
26 
27  void init(JMessageLoggerThreadSafe const& second)
28  {
29  m_mlts = second;
30  }
31 
32  JMessageLoggerThreadSafe& logger()
33  {
34  return m_mlts;
35  }
36 };
37 
38 void initLogger(JMessageLoggerThreadSafe const& second)
39 {
40  MLSing::get().init(second);
41 }
42 
44 {
45  if (m_level == cError) {
46  JLOGGER::JErrorStream(MLSing::get().logger()) << m_stream.str();
47  } else if (m_level == cWarning) {
48  JLOGGER::JWarningStream(MLSing::get().logger()) << m_stream.str();
49  } else if (m_level == cNotice) {
50  JLOGGER::JNoticeStream (MLSing::get().logger()) << m_stream.str();
51  } else if (m_level == cStatus) {
52  JLOGGER::JStatusStream (MLSing::get().logger()) << m_stream.str();
53  } else if (m_level == cDebug) {
54  JLOGGER::JDebugStream (MLSing::get().logger()) << m_stream.str();
55  }
56 }
void initLogger(JLOGGER::JMessageLoggerThreadSafe const &second)
Message reporting compatible with STL output stream operations.
MLSing()
Definition: jlog.cc:15
Definition: jlog.cc:13
~Logger()
Logger without Jpp.
Definition: jlog.cc:43
JMessageLoggerThreadSafe & logger()
Definition: jlog.cc:32
Level specific message streamers.
General purpose message reporting.
void init(JMessageLoggerThreadSafe const &second)
Definition: jlog.cc:27
static MLSing & get()
Definition: jlog.cc:20
JMessageLoggerThreadSafe m_mlts
Definition: jlog.cc:16