CARMA C++
carma::util::Logger Class Reference

A convenience class for returning predefined log4cpp Categories. More...

#include <carma/util/Logger.h>

Public Member Functions

virtual ~Logger ()
 The destructor for Logger. More...
 

Static Public Member Functions

static log4cpp::Category & getFilelogger (const std::string &identity, const std::string &pathname, const std::string &logname="carma.default", bool append=true, mode_t mode=00644, log4cpp::Priority::PriorityLevel priority=log4cpp::Priority::DEBUG, bool traceVerbose=true)
 
static log4cpp::Category & getOstreamlogger (const std::string &identity, std::ostream *stream=&std::cout, const std::string &logname="carma.default", log4cpp::Priority::PriorityLevel priority=log4cpp::Priority::DEBUG, bool traceVerbose=true)
 
static log4cpp::Category & getSyslogger (const std::string &identity, const std::string &host="localhost", const std::string &logname="carma.default", log4cpp::Priority::PriorityLevel priority=log4cpp::Priority::DEBUG, facilityType facility=DEFAULT_FACILITY)
 

Detailed Description

A convenience class for returning predefined log4cpp Categories.

This class has only static methods.

Definition at line 34 of file Logger.h.

Constructor & Destructor Documentation

virtual carma::util::Logger::~Logger ( )
virtual

The destructor for Logger.

Member Function Documentation

static log4cpp::Category& carma::util::Logger::getFilelogger ( const std::string &  identity,
const std::string &  pathname,
const std::string &  logname = "carma.default",
bool  append = true,
mode_t  mode = 00644,
log4cpp::Priority::PriorityLevel  priority = log4cpp::Priority::DEBUG,
bool  traceVerbose = true 
)
static
Returns
a Category instance with a file appender attached. The layout (format) of the log messages is that of FileLayout
Parameters
identityThe identity of the logger, i.e. the program name. This corresponds the ident parameter in the openlog(3) call.
pathnameThe file to open. This corresponds to pathname in open(2).
lognameThe hierarchical namespace for this logger, e.g. "carma.monitor". The root logger will be "carma", all other loggers should be "carma.something[.somethingelse]" to make use of
a) log4cpp's automatic heirarchical logging and
b) for sorting in e.g. database queries.
The default is "carma" but you really should change it.
appendIf the file already exists, true means to append to it, false means truncate it. The file will be opened with default flag O_CREAT | O_APPEND | O_WRONLY.
modeThe file mode as is open(2). The default mode is 00644 (file permission will be mode & ~umask).
priorityThe minimum level of priority that messages must have in order to be logged. Default to Priority::DEBUG
See Also
FileLayout
log4cpp::Category
log4cpp::FileAppender
static log4cpp::Category& carma::util::Logger::getOstreamlogger ( const std::string &  identity,
std::ostream *  stream = &std::cout,
const std::string &  logname = "carma.default",
log4cpp::Priority::PriorityLevel  priority = log4cpp::Priority::DEBUG,
bool  traceVerbose = true 
)
static
Returns
a Category instance with a ostream appender attached. The layout (format) of the log messages is that of FileLayout.
Parameters
identityThe identity of the logger, i.e. the program name. This corresponds the ident parameter in the openlog(3) call.
streamPointer to the output stream to append to, defaults to &std::cerr
lognameThe hierarchical namespace for this logger, e.g. "carma.monitor". The root logger will be "carma", all other loggers should be "carma.something[.somethingelse]" to make use of
a) log4cpp's automatic heirarchical logging and
b) for sorting in e.g. database queries.
The default is "carma.default" but you really should change it.
priorityThe minimum level of priority that messages must have in order to be logged. Default to Priority::DEBUG
See Also
FileLayout
log4cpp::Category
log4cpp::OstreamAppender
static log4cpp::Category& carma::util::Logger::getSyslogger ( const std::string &  identity,
const std::string &  host = "localhost",
const std::string &  logname = "carma.default",
log4cpp::Priority::PriorityLevel  priority = log4cpp::Priority::DEBUG,
facilityType  facility = DEFAULT_FACILITY 
)
static
Returns
A Category instance with either a local or remote syslog appender attached. The layout (format) of the syslog messages is that of SyslogLayout.
Parameters
identityThe identity for the attached Appender, i.e. the program name. This corresponds the ident parameter in the openlog(3) call.
hostThe host name for the syslog. If host string matches that returned by gethostname(3C) or is "localhost", then a SysLogAppender is attached as the default Appender, otherwise a RemoteSysLogAppender is used. The default value is "localhost"
lognameThe hierarchical namespace for this Category, e.g. "carma.monitor". The root logger will be "carma", all other loggers should be "carma.something[.somethingelse]" to make use of
a) log4cpp's automatic heirarchical logging and
b) for sorting in e.g. database queries.
The default is "carma.default" but you really should change it.
priorityThe minimum level of priority that messages must have in order to be logged. Default to Priority::DEBUG
facilityThe syslog facility argument used to specify what type of program is logging the message. This lets the syslog configuration file specify that messages from different facilities will be handled differently. For CARMA we have defined the following facilities:
  • RX_FACILITY - The facility for receivers/antenna IF/dewar (local1)
  • DEFAULT_FACILITY - The default facility (local2), use if no facility is specified. logname will default to "carma.default"
  • MONITOR_FACILITY - The facility for the Monitor and Fault Systems (local3). logname will default * to "carma.monitor"
  • INTERFEROMETRY_FACILITY - For the correlator, lobe rotator, and delay engine (local4) logname will default * to "carma.interferometry"
  • CONTROL_FACILITY - For the control system and SAT. (local5) logname will default * to "carma.control"
  • ENVIRONMENT_FACILITY - For Phase Monitor, WVR, Weather Station, Linelength System, and LO Reference. (local6) logname will default * to "carma.environment"
Facilities local0 and local1 are reserved for future use; local7 is already used by RedHat.
See Also
syslog(3) man page.
SyslogLayout
log4cpp::Category
log4cpp::SyslogAppender
log4cpp::RemoteSyslogAppender

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