CernVM-FS  2.11.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_UTIL_LOGGING_INTERNAL_H_
8 #define CVMFS_UTIL_LOGGING_INTERNAL_H_
9 
10 #include <cstdarg>
11 #include <ctime>
12 #include <string>
13 #include <vector>
14 
15 #include "util/export.h"
16 
17 #ifdef CVMFS_NAMESPACE_GUARD
18 namespace CVMFS_NAMESPACE_GUARD {
19 #endif
20 
22  kLogDebug = 0x01,
23  kLogStdout = 0x02,
24  kLogStderr = 0x04,
25  kLogSyslog = 0x08,
27  kLogSyslogErr = 0x20,
28  kLogCustom0 = 0x40,
29  kLogCustom1 = 0x80,
30  kLogCustom2 = 0x100,
31 };
32 
52  static void Set(LogFacilities info, LogFacilities error);
53 
54  static LogFacilities info; // default kLogStdout
55  static LogFacilities error; // default kLogStderr
56 };
57 
58 enum LogFlags {
59  kLogNoLinebreak = 0x200,
60  kLogShowSource = 0x400,
61  kLogSensitive = 0x800,
62 };
63 
64 enum LogLevels {
65  kLogLevel0 = 0x01000,
66  kLogNormal = 0x02000,
67  kLogInform = 0x04000,
68  kLogVerbose = 0x08000,
69  kLogNone = 0x10000,
70 };
71 
76 enum LogSource {
77  kLogCache = 1,
111 };
112 
116 
118  LogBufferEntry(LogSource s, int m, const std::string &msg)
119  : timestamp(time(NULL)), source(s), mask(m), message(msg) { }
120 
121  time_t timestamp;
123  int mask;
124  std::string message;
125 };
126 
127 CVMFS_EXPORT void SetLogSyslogLevel(const int level);
129 CVMFS_EXPORT void SetLogSyslogFacility(const int facility);
131 CVMFS_EXPORT void SetLogCustomFile(unsigned id, const std::string &filename);
132 CVMFS_EXPORT void SetLogMicroSyslog(const std::string &filename);
133 CVMFS_EXPORT std::string GetLogMicroSyslog();
134 CVMFS_EXPORT void SetLogMicroSyslogMaxSize(unsigned bytes);
135 CVMFS_EXPORT void SetLogSyslogPrefix(const std::string &prefix);
136 CVMFS_EXPORT void SetLogSyslogShowPID(bool flag);
137 CVMFS_EXPORT void SetLogVerbosity(const LogLevels max_level);
139 
140 #ifdef DEBUGMSG
141 CVMFS_EXPORT void SetLogDebugFile(const std::string &filename);
142 CVMFS_EXPORT std::string GetLogDebugFile();
143 #else
144 #define SetLogDebugFile(filename) ((void)0)
145 #define GetLogDebugFile() (std::string(""))
146 #endif
147 
149 void SetAltLogFunc(void (*fn)(const LogSource source, const int mask,
150  const char *msg));
151 
152 CVMFS_EXPORT std::vector<LogBufferEntry> GetLogBuffer();
154 
155 CVMFS_EXPORT void PrintWarning(const std::string &message);
156 CVMFS_EXPORT void PrintError(const std::string &message);
157 
158 #ifdef CVMFS_NAMESPACE_GUARD
159 } // namespace CVMFS_NAMESPACE_GUARD
160 #endif
161 
162 #endif // CVMFS_UTIL_LOGGING_INTERNAL_H_
std::vector< LogBufferEntry > GetLogBuffer()
Definition: logging.cc:535
void SetLogSyslogFacility(const int local_facility)
Definition: logging.cc:183
void SetLogVerbosity(const LogLevels max_level)
Definition: logging.cc:261
void SetLogSyslogLevel(const int level)
Definition: logging.cc:151
LogSource source
void SetLogSyslogShowPID(bool flag)
Definition: logging.cc:254
time_t timestamp
const int kLogWarning
LogFlags
#define CVMFS_EXPORT
Definition: export.h:11
void SetLogMicroSyslogMaxSize(unsigned bytes)
Definition: logging.cc:264
int mask
void SetAltLogFunc(void(*fn)(const LogSource source, const int mask, const char *msg))
Definition: logging.cc:408
void SetLogMicroSyslog(const std::string &filename)
Definition: logging.cc:272
#define SetLogDebugFile(filename)
int GetLogSyslogLevel()
Definition: logging.cc:168
#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:555
std::string GetLogMicroSyslog()
Definition: logging.cc:308
void PrintWarning(const string &message)
Definition: logging.cc:547
LogBufferEntry(LogSource s, int m, const std::string &msg)
LogLevels
void LogShutdown()
Definition: logging.cc:606
void ClearLogBuffer()
Definition: logging.cc:539
LogFacilities
std::string message
const int kLogVerboseMsg
void SetLogSyslogPrefix(const std::string &prefix)
Definition: logging.cc:241
void PrintError(const string &message)
Definition: logging.cc:543
static LogFacilities info
const int kLogInfoMsg
static LogFacilities error
int GetLogSyslogFacility()
Definition: logging.cc:214