CernVM-FS  2.10.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
logging_internal.h
Go to the documentation of this file.
1 
5 // Internal use, include only logging.h!
6 
7 #ifndef CVMFS_LOGGING_INTERNAL_H_
8 #define CVMFS_LOGGING_INTERNAL_H_
9 
10 #include <cstdarg>
11 #include <ctime>
12 #include <string>
13 #include <vector>
14 
15 #ifdef CVMFS_NAMESPACE_GUARD
16 namespace CVMFS_NAMESPACE_GUARD {
17 #endif
18 
20  kLogDebug = 0x01,
21  kLogStdout = 0x02,
22  kLogStderr = 0x04,
23  kLogSyslog = 0x08,
25  kLogSyslogErr = 0x20,
26  kLogCustom0 = 0x40,
27  kLogCustom1 = 0x80,
28  kLogCustom2 = 0x100,
29 };
30 
50  static void Set(LogFacilities info, LogFacilities error);
51 
52  static LogFacilities info; // default kLogStdout
53  static LogFacilities error; // default kLogStderr
54 };
55 
56 enum LogFlags {
57  kLogNoLinebreak = 0x200,
58  kLogShowSource = 0x400,
59  kLogSensitive = 0x800,
60 };
61 
62 enum LogLevels {
63  kLogLevel0 = 0x01000,
64  kLogNormal = 0x02000,
65  kLogInform = 0x04000,
66  kLogVerbose = 0x08000,
67  kLogNone = 0x10000,
68 };
69 
74 enum LogSource {
75  kLogCache = 1,
108 };
109 
113 
115  LogBufferEntry(LogSource s, int m, const std::string &msg)
116  : timestamp(time(NULL)), source(s), mask(m), message(msg) { }
117 
118  time_t timestamp;
120  int mask;
121  std::string message;
122 };
123 
124 void SetLogSyslogLevel(const int level);
125 int GetLogSyslogLevel();
126 void SetLogSyslogFacility(const int facility);
128 void SetLogCustomFile(unsigned id, const std::string &filename);
129 void SetLogMicroSyslog(const std::string &filename);
130 std::string GetLogMicroSyslog();
131 void SetLogSyslogPrefix(const std::string &prefix);
132 void SetLogSyslogShowPID(bool flag);
133 void SetLogVerbosity(const LogLevels max_level);
134 void LogShutdown();
135 
136 #ifdef DEBUGMSG
137 void SetLogDebugFile(const std::string &filename);
138 std::string GetLogDebugFile();
139 #else
140 #define SetLogDebugFile(filename) ((void)0)
141 #define GetLogDebugFile() (std::string(""))
142 #endif
143 
144 void SetAltLogFunc(void (*fn)(const LogSource source, const int mask,
145  const char *msg));
146 
147 std::vector<LogBufferEntry> GetLogBuffer();
148 void ClearLogBuffer();
149 
150 #ifdef CVMFS_NAMESPACE_GUARD
151 } // namespace CVMFS_NAMESPACE_GUARD
152 #endif
153 
154 #endif // CVMFS_LOGGING_INTERNAL_H_
std::vector< LogBufferEntry > GetLogBuffer()
Definition: logging.cc:524
void SetLogSyslogFacility(const int local_facility)
Definition: logging.cc:182
void SetLogVerbosity(const LogLevels max_level)
Definition: logging.cc:260
void SetLogSyslogLevel(const int level)
Definition: logging.cc:150
LogSource source
void SetLogSyslogShowPID(bool flag)
Definition: logging.cc:253
time_t timestamp
const int kLogWarning
LogFlags
int mask
void SetAltLogFunc(void(*fn)(const LogSource source, const int mask, const char *msg))
Definition: logging.cc:403
void SetLogMicroSyslog(const std::string &filename)
Definition: logging.cc:267
#define SetLogDebugFile(filename)
int GetLogSyslogLevel()
Definition: logging.cc:167
#define GetLogDebugFile()
Don&#39;t add the line to the memory log buffer.
LogSource
void SetLogCustomFile(unsigned id, const std::string &filename)
Definition: logging.cc:544
std::string GetLogMicroSyslog()
Definition: logging.cc:303
LogBufferEntry(LogSource s, int m, const std::string &msg)
LogLevels
void LogShutdown()
Definition: logging.cc:595
void ClearLogBuffer()
Definition: logging.cc:528
LogFacilities
std::string message
const int kLogVerboseMsg
void SetLogSyslogPrefix(const std::string &prefix)
Definition: logging.cc:240
static LogFacilities info
const int kLogInfoMsg
static LogFacilities error
int GetLogSyslogFacility()
Definition: logging.cc:213