xrootd
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
XrdCl::Log Class Reference

Handle diagnostics. More...

#include <XrdClLog.hh>

Collaboration diagram for XrdCl::Log:
Collaboration graph
[legend]

Public Types

enum  LogLevel {
  NoMsg = 0 , ErrorMsg = 1 , WarningMsg = 2 , InfoMsg = 3 ,
  DebugMsg = 4 , DumpMsg = 5
}
 Log levels. More...
 

Public Member Functions

 Log ()
 Constructor.
 
 ~Log ()
 
void Error (uint64_t topic, const char *format,...)
 Report an error.
 
void Warning (uint64_t topic, const char *format,...)
 Report a warning.
 
void Info (uint64_t topic, const char *format,...)
 Print an info.
 
void Debug (uint64_t topic, const char *format,...)
 Print a debug message.
 
void Dump (uint64_t topic, const char *format,...)
 Print a dump message.
 
void Say (LogLevel level, uint64_t topic, const char *format, va_list list)
 
void SetLevel (LogLevel level)
 Set the level of the messages that should be sent to the destination.
 
void SetLevel (const std::string &level)
 Set the level of the messages that should be sent to the destination.
 
void SetOutput (LogOut *output)
 Set the output that should be used.
 
void SetMask (LogLevel level, uint64_t mask)
 Sets the mask for the topics of messages that should be printed.
 
void SetMask (const std::string &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.
 
uint64_t RegisterTopic (const std::string &topic)
 Register new topic.
 
LogLevel GetLevel () const
 Get the log level.
 
void SetPid (pid_t pid)
 Set pid.
 

Private Types

typedef std::map< uint64_t, std::string > TopicMap
 

Private Member Functions

std::string LogLevelToString (LogLevel level)
 
bool StringToLogLevel (const std::string &strLevel, LogLevel &level)
 
std::string TopicToString (uint64_t topic)
 

Private Attributes

std::atomic< LogLevelpLevel
 
uint64_t pMask [DumpMsg+1]
 
LogOutpOutput
 
TopicMap pTopicMap
 
uint32_t pTopicMaxLength
 
pid_t pPid
 

Detailed Description

Handle diagnostics.

Member Typedef Documentation

◆ TopicMap

typedef std::map<uint64_t, std::string> XrdCl::Log::TopicMap
private

Member Enumeration Documentation

◆ LogLevel

Log levels.

Enumerator
NoMsg 

report nothing

ErrorMsg 

report errors

WarningMsg 

report warnings

InfoMsg 

print info

DebugMsg 

print debug info

DumpMsg 

print details of the request and responses

Constructor & Destructor Documentation

◆ Log()

XrdCl::Log::Log ( )
inline

Constructor.

References DumpMsg, pMask, and pOutput.

◆ ~Log()

XrdCl::Log::~Log ( )
inline

References pOutput.

Member Function Documentation

◆ Debug()

void XrdCl::Log::Debug ( uint64_t  topic,
const char *  format,
  ... 
)

◆ Dump()

void XrdCl::Log::Dump ( uint64_t  topic,
const char *  format,
  ... 
)

◆ Error()

void XrdCl::Log::Error ( uint64_t  topic,
const char *  format,
  ... 
)

◆ GetLevel()

LogLevel XrdCl::Log::GetLevel ( ) const
inline

Get the log level.

References pLevel.

◆ Info()

void XrdCl::Log::Info ( uint64_t  topic,
const char *  format,
  ... 
)

Print an info.

◆ LogLevelToString()

std::string XrdCl::Log::LogLevelToString ( LogLevel  level)
private

◆ RegisterTopic()

uint64_t XrdCl::Log::RegisterTopic ( const std::string &  topic)
inline

Register new topic.

References pTopicMap, and SetTopicName().

◆ Say()

void XrdCl::Log::Say ( LogLevel  level,
uint64_t  topic,
const char *  format,
va_list  list 
)

Always print the message

Parameters
levellog level
topictopic of the message
formatformat string - the same as in printf
listlist of arguments

◆ SetLevel() [1/2]

void XrdCl::Log::SetLevel ( const std::string &  level)
inline

Set the level of the messages that should be sent to the destination.

References SetLevel(), and StringToLogLevel().

◆ SetLevel() [2/2]

void XrdCl::Log::SetLevel ( LogLevel  level)
inline

Set the level of the messages that should be sent to the destination.

References pLevel.

Referenced by SetLevel().

◆ SetMask() [1/2]

void XrdCl::Log::SetMask ( const std::string &  level,
uint64_t  mask 
)
inline

Sets the mask for the topics of messages that should be printed.

References pMask, and StringToLogLevel().

◆ SetMask() [2/2]

void XrdCl::Log::SetMask ( LogLevel  level,
uint64_t  mask 
)
inline

Sets the mask for the topics of messages that should be printed.

References pMask.

◆ SetOutput()

void XrdCl::Log::SetOutput ( LogOut output)
inline

Set the output that should be used.

References pOutput.

◆ SetPid()

void XrdCl::Log::SetPid ( pid_t  pid)
inline

Set pid.

References pPid.

◆ SetTopicName()

void XrdCl::Log::SetTopicName ( uint64_t  topic,
std::string  name 
)

Map a topic number to a string.

Referenced by RegisterTopic().

◆ StringToLogLevel()

bool XrdCl::Log::StringToLogLevel ( const std::string &  strLevel,
LogLevel level 
)
private

Referenced by SetLevel(), and SetMask().

◆ TopicToString()

std::string XrdCl::Log::TopicToString ( uint64_t  topic)
private

◆ Warning()

void XrdCl::Log::Warning ( uint64_t  topic,
const char *  format,
  ... 
)

Member Data Documentation

◆ pLevel

std::atomic<LogLevel> XrdCl::Log::pLevel
private

Referenced by GetLevel(), and SetLevel().

◆ pMask

uint64_t XrdCl::Log::pMask[DumpMsg+1]
private

Referenced by Log(), SetMask(), and SetMask().

◆ pOutput

LogOut* XrdCl::Log::pOutput
private

Referenced by Log(), SetOutput(), and ~Log().

◆ pPid

pid_t XrdCl::Log::pPid
private

Referenced by SetPid().

◆ pTopicMap

TopicMap XrdCl::Log::pTopicMap
private

Referenced by RegisterTopic().

◆ pTopicMaxLength

uint32_t XrdCl::Log::pTopicMaxLength
private

The documentation for this class was generated from the following file: