LogMsg.h
Go to the documentation of this file.
1 #ifndef __MSGLOGGER_H__
2 #define __MSGLOGGER_H__
3 
4 #include <ostream>
5 #include <iostream>
6 
7 namespace dlardaq
8 {
9  class LogStream
10  {
11  public:
12  LogStream(std::ostream& _out, std::string& _msg) : out(_out), msg(_msg){;}
13  template<typename T>
14  std::ostream& operator<<(const T& v)
15  {out<<msg<<v; return out; }
16  protected:
17  std::ostream& out;
19  };
20 
21  static std::string _strinfo = "[ \033[22;32mINFO\033[0m ] ";
22  static std::string _strwarn = "[ \033[01;35mWARN\033[0m ] ";
23  static std::string _strerror = "[ \033[22;31mERROR\033[0m ] ";
24 
25  static LogStream msg_info(std::cout, _strinfo);
26  static LogStream msg_warn(std::cout, _strwarn);
27  static LogStream msg_err(std::cerr, _strerror);
28 }
29 
30 #endif
static LogStream msg_warn(std::cout, _strwarn)
std::string msg
Definition: LogMsg.h:18
std::string string
Definition: nybbler.cc:12
static std::string _strinfo
Definition: LogMsg.h:21
static std::string _strwarn
Definition: LogMsg.h:22
LogStream(std::ostream &_out, std::string &_msg)
Definition: LogMsg.h:12
static std::string _strerror
Definition: LogMsg.h:23
static LogStream msg_info(std::cout, _strinfo)
std::ostream & operator<<(const T &v)
Definition: LogMsg.h:14
std::ostream & out
Definition: LogMsg.h:17
static LogStream msg_err(std::cerr, _strerror)