25#ifndef __XRD_CL_LOG_HH__
26#define __XRD_CL_LOG_HH__
58 virtual void Write(
const std::string &message ) = 0;
73 bool Open(
const std::string &fileName );
79 virtual void Write(
const std::string &message );
91 virtual void Write(
const std::string &message );
119 Log(): pLevel(
NoMsg ), pTopicMaxLength( 18 ), pPid(0)
123 for(
int i = 0; i < maxMask; ++i )
124 pMask[i] = 0xffffffffffffffffULL;
138 void Error( uint64_t topic,
const char *format, ... );
143 void Warning( uint64_t topic,
const char *format, ... );
148 void Info( uint64_t topic,
const char *format, ... );
153 void Debug( uint64_t topic,
const char *format, ... );
158 void Dump( uint64_t topic,
const char *format, ... );
168 void Say(
LogLevel level, uint64_t topic,
const char *format, va_list list );
175#if __cplusplus >= 201103L
176 pLevel.store(level, std::memory_order_relaxed);
188 if( StringToLogLevel( level, lvl ) )
212 void SetMask(
const std::string &level, uint64_t mask )
215 if( StringToLogLevel( level, lvl ) )
230 uint64_t tpcnb = pTopicMap.rbegin()->first << 1;
240 LogLevel lvl = pLevel.load(std::memory_order_relaxed);
253 typedef std::map<uint64_t, std::string> TopicMap;
254 std::string LogLevelToString(
LogLevel level );
255 bool StringToLogLevel(
const std::string &strLevel,
LogLevel &level );
256 std::string TopicToString( uint64_t topic );
258 std::atomic<LogLevel> pLevel;
263 uint32_t pTopicMaxLength;
XrdOucPup XrdCmsParser::Pup & Say
Write log messages to stderr.
virtual void Write(const std::string &message)
Write log messages to a file.
virtual void Write(const std::string &message)
void Close()
Close the log file.
bool Open(const std::string &fileName)
Open the log file.
Interface for logger outputs.
virtual void Write(const std::string &message)=0
void SetLevel(const std::string &level)
Set the level of the messages that should be sent to the destination.
@ WarningMsg
report warnings
@ DebugMsg
print debug info
@ DumpMsg
print details of the request and responses
uint64_t RegisterTopic(const std::string &topic)
Register new topic.
void SetMask(LogLevel level, uint64_t mask)
Sets the mask for the topics of messages that should be printed.
void SetTopicName(uint64_t topic, std::string name)
Map a topic number to a string.
void SetMask(const std::string &level, uint64_t mask)
Sets the mask for the topics of messages that should be printed.
void SetLevel(LogLevel level)
Set the level of the messages that should be sent to the destination.
LogLevel GetLevel() const
Get the log level.
void Warning(uint64_t topic, const char *format,...)
Report a warning.
void Dump(uint64_t topic, const char *format,...)
Print a dump message.
void Info(uint64_t topic, const char *format,...)
Print an info.
void SetOutput(LogOut *output)
Set the output that should be used.
void SetPid(pid_t pid)
Set pid.