Belle II Software  release-08-01-10
RFLogManager.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 #ifndef RFLOGMANAGER_H
9 #define RFLOGMANAGER_H
10 
11 #include <stdio.h>
12 
13 namespace Belle2 {
18  class RFLogManager {
19  public:
20  RFLogManager(const char* prefix, const char* lognode = NULL, const char* logdir = NULL);
21  ~RFLogManager();
22 
23  // Read messages from fd and log them
24  int ProcessLog(int fd);
25 
26  // Logger functions
27  void Log(const char* fmt, ...);
28  void Info(const char* fmt, ...);
29  void Warning(const char* fmt, ...);
30  void Error(const char* fmt, ...);
31  void Fatal(const char* fmt, ...);
32  void Abort(const char* fmt, ...);
33 
34  // Basic interface
35  void Write(const char* msg);
36  char* BuildMessage(const char* fmt, ...);
37 
38  private:
39  int today();
40  void timestamp(char*);
41  int WriteLog(const char* type, const char* msg);
42  int OpenLogFile(int today);
43  int SwitchLogFile();
44 
45  private:
46  int m_logdate;
47  char m_logdir[1024];
48  char m_id[256];
49  char m_strbuf[1024];
50  int m_fd;
51  char m_lognode[1024];
52 
53  };
54 
56 }
57 #endif
58 
Abstract base class for different kinds of events.