EUDAQ
 All Classes Namespaces Files Functions Variables Pages
LogSender.hh
1 #ifndef EUDAQ_INCLUDED_LogSender
2 #define EUDAQ_INCLUDED_LogSender
3 
4 #include "eudaq/TransportClient.hh"
5 #include "eudaq/Serializer.hh"
6 #include "eudaq/Status.hh"
7 #include "eudaq/Mutex.hh"
8 #include "Platform.hh"
9 #include <string>
10 
11 namespace eudaq {
12 
13  class LogMessage;
14 
15  class DLLEXPORT LogSender {
16  public:
17  LogSender();
18  ~LogSender();
19  void Connect(const std::string &type, const std::string &name,
20  const std::string &server);
21  void Disconnect();
22  void SendLogMessage(const LogMessage &);
23  void SendLogMessage(const LogMessage &msg, std::ostream &out,
24  std::ostream &error_out);
25  void SetLevel(int level) { m_level = level; }
26  void SetLevel(const std::string &level) {
27  SetLevel(Status::String2Level(level));
28  }
29  void SetErrLevel(int level) { m_errlevel = level; }
30  void SetErrLevel(const std::string &level) {
31  SetErrLevel(Status::String2Level(level));
32  }
33  bool IsLogged(const std::string &level) {
34  return Status::String2Level(level) >= m_level;
35  }
36 
37  private:
38  std::string m_name;
39  TransportClient *m_logclient;
40  int m_level;
41  int m_errlevel;
42  bool m_shownotconnected;
43  bool isConnected = false;
44  Mutex m_mutex;
45  };
46 }
47 
48 #endif // EUDAQ_INCLUDED_LogSender
Definition: LogSender.hh:15
Definition: Mutex.hh:8
Definition: LogMessage.hh:15
Definition: TransportClient.hh:9