Logger Class Reference

Inheritance diagram for Logger:

LoggerTransport Capability List of all members.

Detailed Description

Instantiation of Logger interface.

Please read the documentation for RobotObjects for other important functions. Data structures will be placed behind accessor functions in the future.

Definition at line 53 of file Logger.H.

Public Member Functions

 Logger (std::string somename)
 Normal constructor.
 Logger (std::string somename, std::string filename)
 Constructor for logging to file as well as other methods.
 ~Logger ()
void initLogger ()
void log (std::string somestring, int priority)
 Totally experimental.
void debug (std::string somestring)
 Short version for debug logging.
void info (std::string somestring)
 Short version for info logging.
void notice (std::string somestring)
 Short version for notice logging.
void warn (std::string somestring)
 Short version for warn logging.
void error (std::string somestring)
 Short version for error logging.
void fatal (std::string somestring)
 Short version for fatal logging.
void log (std::string somestring)
 Basic logging function.
void setNetworkLogging (bool value)
 Specify whether or not to log to the network.
void setSysLogging (bool value)
 Specify whether or not to log to syslog.
void setStderr (bool value)
 Specify whether or not syslog should send to stderr.
void logData (std::string description, std::string format, std::string data)
 DO NOT USE THIS FUNCTION.
void setLogLevel (int priority)
 Sets the loglevel to start logging.

Private Member Functions

void init (std::string somename)

Private Attributes

std::string m_outFilename
bool m_toFile
bool m_toNetwork
bool m_toSyslog
bool m_toStderr
int m_logLevel
bool m_init
std::string m_logName
pthread_mutex_t mutex


Constructor & Destructor Documentation

Logger ( std::string  somename  ) 

Normal constructor.

Please use this one.

Definition at line 45 of file Logger.cpp.

References WURDE::g_robotLoggerPtr, Logger::m_init, Logger::m_logLevel, Logger::m_logName, Logger::m_toFile, Logger::m_toNetwork, Logger::m_toStderr, Logger::m_toSyslog, LoggerTransport::setGlobalName(), Logger::setNetworkLogging(), Logger::setStderr(), and Logger::setSysLogging().

Logger ( std::string  somename,
std::string  filename 
)

Constructor for logging to file as well as other methods.

Best not to use this now, as file logging isn't complete.

Definition at line 68 of file Logger.cpp.

References WURDE::g_robotLoggerPtr, Logger::m_init, Logger::m_logName, Logger::m_outFilename, Logger::m_toFile, Logger::m_toNetwork, Logger::m_toStderr, Logger::m_toSyslog, LoggerTransport::setGlobalName(), Logger::setNetworkLogging(), Logger::setStderr(), and Logger::setSysLogging().

~Logger (  )  [inline]

Definition at line 67 of file Logger.H.


Member Function Documentation

void initLogger (  ) 

Definition at line 91 of file Logger.cpp.

References WURDE::g_globalConfiguration, WURDEConfiguration::getLogLevel(), Logger::m_init, Logger::m_logLevel, and Logger::mutex.

Referenced by Logger::log().

void log ( std::string  somestring,
int  priority 
)

Totally experimental.

This function includes a priority. Use the syslog priorities with it. They are: LOG_EMERG system is unusable, LOG_ALERT action must be taken immediately, LOG_CRIT critical conditions, LOG_ERR error conditions, LOG_WARNING warning conditions, LOG_NOTICE normal, but significant, condition, LOG_INFO informational message, LOG_DEBUG debug-level message.

In general, only use DEBUG through ERR. Use CRIT if it is a fatal condition.

NOTE: It is up to YOU to exit if a fatal condition is reached. The logging system should not kill the process.

A newline is appended to the logged string.

Note that the facility value for syslog will be set to local0. ident for syslog will be set to "Robot" and the actual module name is prepended by the logger.

Definition at line 109 of file Logger.cpp.

References LoggerTransport::data, Logger::initLogger(), LoggerTransportDataStruct::logData, LoggerTransportDataStruct::logFormat, LoggerTransportDataStruct::logString, Logger::m_init, Logger::m_logLevel, Logger::m_logName, Logger::m_toFile, Logger::m_toNetwork, Logger::m_toSyslog, Logger::mutex, LoggerTransportDataStruct::priority, WURDE::priorityToString(), LoggerTransport::publishData(), and LoggerTransport::runUpdate().

Referenced by Logger::debug(), Logger::error(), Logger::fatal(), WURDE::g_log(), Logger::info(), Logger::log(), Logger::notice(), and Logger::warn().

void debug ( std::string  somestring  )  [inline]

Short version for debug logging.

Definition at line 125 of file Logger.H.

References Logger::log().

void info ( std::string  somestring  )  [inline]

Short version for info logging.

Definition at line 129 of file Logger.H.

References Logger::log().

void notice ( std::string  somestring  )  [inline]

Short version for notice logging.

Definition at line 133 of file Logger.H.

References Logger::log().

void warn ( std::string  somestring  )  [inline]

Short version for warn logging.

Definition at line 137 of file Logger.H.

References Logger::log().

void error ( std::string  somestring  )  [inline]

Short version for error logging.

Definition at line 141 of file Logger.H.

References Logger::log().

void fatal ( std::string  somestring  )  [inline]

Short version for fatal logging.

Definition at line 146 of file Logger.H.

References Logger::log().

void log ( std::string  somestring  )  [inline]

Basic logging function.

Strings logged with this function will be given a priority of LOG_INFO.

Definition at line 151 of file Logger.H.

References Logger::log().

void setNetworkLogging ( bool  value  ) 

Specify whether or not to log to the network.

Default is yes.

Definition at line 142 of file Logger.cpp.

References LoggerTransport::data, LoggerTransportDataStruct::logData, LoggerTransportDataStruct::logFormat, LoggerTransportDataStruct::logString, Capability::m_globalname, Logger::m_toNetwork, Time::now(), LoggerTransportDataStruct::source, and LoggerTransportDataStruct::timestamp.

Referenced by Logger::Logger().

void setSysLogging ( bool  value  ) 

Specify whether or not to log to syslog.

Default is yes.

Definition at line 155 of file Logger.cpp.

References Logger::m_toStderr, and Logger::m_toSyslog.

Referenced by Logger::Logger().

void setStderr ( bool  value  ) 

Specify whether or not syslog should send to stderr.

Default is yes.

Definition at line 170 of file Logger.cpp.

References Logger::m_toStderr, and Logger::m_toSyslog.

Referenced by Logger::Logger().

void logData ( std::string  description,
std::string  format,
std::string  data 
)

DO NOT USE THIS FUNCTION.

It is incomplete.

void setLogLevel ( int  priority  )  [inline]

Sets the loglevel to start logging.

Default is LOG_DEBUG. Levels above the specified level will not be logged (at all).

Definition at line 177 of file Logger.H.

References Logger::m_logLevel.

Referenced by CommsManager::parseOptions().

void init ( std::string  somename  )  [private]


Member Data Documentation

std::string m_outFilename [private]

Definition at line 187 of file Logger.H.

Referenced by Logger::Logger().

bool m_toFile [private]

Definition at line 188 of file Logger.H.

Referenced by Logger::log(), and Logger::Logger().

bool m_toNetwork [private]

Definition at line 191 of file Logger.H.

Referenced by Logger::log(), Logger::Logger(), and Logger::setNetworkLogging().

bool m_toSyslog [private]

Definition at line 194 of file Logger.H.

Referenced by Logger::log(), Logger::Logger(), Logger::setStderr(), and Logger::setSysLogging().

bool m_toStderr [private]

Definition at line 197 of file Logger.H.

Referenced by Logger::Logger(), Logger::setStderr(), and Logger::setSysLogging().

int m_logLevel [private]

Definition at line 199 of file Logger.H.

Referenced by Logger::initLogger(), Logger::log(), Logger::Logger(), and Logger::setLogLevel().

bool m_init [private]

Definition at line 201 of file Logger.H.

Referenced by Logger::initLogger(), Logger::log(), and Logger::Logger().

std::string m_logName [private]

Definition at line 202 of file Logger.H.

Referenced by Logger::log(), and Logger::Logger().

pthread_mutex_t mutex [private]

Definition at line 204 of file Logger.H.

Referenced by Logger::initLogger(), and Logger::log().


The documentation for this class was generated from the following files:
Generated on Thu Feb 1 15:31:56 2007 for WURDE by  doxygen 1.5.1