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_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,
110 };
111 
115 
117  LogBufferEntry(LogSource s, int m, const std::string &msg)
118  : timestamp(time(NULL)), source(s), mask(m), message(msg) { }
119 
120  time_t timestamp;
122  int mask;
123  std::string message;
124 };
125 
126 CVMFS_EXPORT void SetLogSyslogLevel(const int level);
128 CVMFS_EXPORT void SetLogSyslogFacility(const int facility);
130 CVMFS_EXPORT void SetLogCustomFile(unsigned id, const std::string &filename);
131 CVMFS_EXPORT void SetLogMicroSyslog(const std::string &filename);
132 CVMFS_EXPORT std::string GetLogMicroSyslog();
133 CVMFS_EXPORT void SetLogMicroSyslogMaxSize(unsigned bytes);
134 CVMFS_EXPORT void SetLogSyslogPrefix(const std::string &prefix);
135 CVMFS_EXPORT void SetLogSyslogShowPID(bool flag);
136 CVMFS_EXPORT void SetLogVerbosity(const LogLevels max_level);
138 
139 #ifdef DEBUGMSG
140 CVMFS_EXPORT void SetLogDebugFile(const std::string &filename);
141 CVMFS_EXPORT std::string GetLogDebugFile();
142 #else
143 #define SetLogDebugFile(filename) ((void)0)
144 #define GetLogDebugFile() (std::string(""))
145 #endif
146 
148 void SetAltLogFunc(void (*fn)(const LogSource source, const int mask,
149  const char *msg));
150 
151 CVMFS_EXPORT std::vector<LogBufferEntry> GetLogBuffer();
153 
154 CVMFS_EXPORT void PrintWarning(const std::string &message);
155 CVMFS_EXPORT void PrintError(const std::string &message);
156 
157 #ifdef CVMFS_NAMESPACE_GUARD
158 } // namespace CVMFS_NAMESPACE_GUARD
159 #endif
160 
161 #endif // CVMFS_UTIL_LOGGING_INTERNAL_H_
std::vector< LogBufferEntry > GetLogBuffer()
Definition: logging.cc:530
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:550
std::string GetLogMicroSyslog()
Definition: logging.cc:308
void PrintWarning(const string &message)
Definition: logging.cc:542
LogBufferEntry(LogSource s, int m, const std::string &msg)
LogLevels
void LogShutdown()
Definition: logging.cc:601
void ClearLogBuffer()
Definition: logging.cc:534
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:538
static LogFacilities info
const int kLogInfoMsg
static LogFacilities error
int GetLogSyslogFacility()
Definition: logging.cc:214