Jpp  master_rocky-40-g5f0272dcd
the software that should make you happy
JStreamLogger.hh
Go to the documentation of this file.
1 #ifndef __JLOGGER__JSTREAMLOGGER__
2 #define __JLOGGER__JSTREAMLOGGER__
3 
4 #include <ostream>
5 
6 #include "JLogger/JLogger.hh"
7 
8 
9 /**
10  * \author mdejong
11  */
12 
13 namespace JLOGGER {}
14 namespace JPP { using namespace JLOGGER; }
15 
16 namespace JLOGGER {
17 
18  /**
19  * Message logging based on std::ostream.
20  * This class implements the JLogger interface.
21  */
22  class JStreamLogger :
23  public JLogger
24  {
25  public:
26  /**
27  * Constructor.
28  *
29  * \param __out output stream
30  */
31  JStreamLogger(std::ostream& __out) :
32  out(__out)
33  {}
34 
35 
36  /**
37  * Report message
38  *
39  * \param tag tag
40  * \param message message
41  */
42  virtual void typeout(const std::string& tag,
43  const std::string& message) override
44  {
45  out << tag << ' ' << message << std::endl;
46  }
47 
48  protected:
49  std::ostream& out;
50  };
51 }
52 
53 #endif
Interface for logging messages.
Definition: JLogger.hh:22
Message logging based on std::ostream.
virtual void typeout(const std::string &tag, const std::string &message) override
Report message.
JStreamLogger(std::ostream &__out)
Constructor.
Message logging.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).