CernVM-FS  2.12.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,
112 };
113 
117 
119  LogBufferEntry(LogSource s, int m, const std::string &msg)
120  : timestamp(time(NULL)), source(s), mask(m), message(msg) { }
121 
122  time_t timestamp;
124  int mask;
125  std::string message;
126 };
127 
128 CVMFS_EXPORT void SetLogSyslogLevel(const int level);
130 CVMFS_EXPORT void SetLogSyslogFacility(const int facility);
132 CVMFS_EXPORT void SetLogCustomFile(unsigned id, const std::string &filename);
133 CVMFS_EXPORT void SetLogMicroSyslog(const std::string &filename);
134 CVMFS_EXPORT std::string GetLogMicroSyslog();
135 CVMFS_EXPORT void SetLogMicroSyslogMaxSize(unsigned bytes);
136 CVMFS_EXPORT void SetLogSyslogPrefix(const std::string &prefix);
137 CVMFS_EXPORT void SetLogSyslogShowPID(bool flag);
138 CVMFS_EXPORT void SetLogVerbosity(const LogLevels max_level);
140 
141 #ifdef DEBUGMSG
142 CVMFS_EXPORT void SetLogDebugFile(const std::string &filename);
143 CVMFS_EXPORT std::string GetLogDebugFile();
144 #else
145 #define SetLogDebugFile(filename) ((void)0)
146 #define GetLogDebugFile() (std::string(""))
147 #endif
148 
150 void SetAltLogFunc(void (*fn)(const LogSource source, const int mask,
151  const char *msg));
152 
153 CVMFS_EXPORT std::vector<LogBufferEntry> GetLogBuffer();
155 
156 CVMFS_EXPORT void PrintWarning(const std::string &message);
157 CVMFS_EXPORT void PrintError(const std::string &message);
158 
159 #ifdef CVMFS_NAMESPACE_GUARD
160 } // namespace CVMFS_NAMESPACE_GUARD
161 #endif
162 
163 #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
const int mask
Definition: logging.h:23
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