#include <loggingLogger.h>
Classes | |
class | Logger_ptr |
Public Types | |
typedef Loki::SmartPtr< Logger, Loki::RefCountedMTAdj < Loki::ObjectLevelLockable > ::RefCountedMT, Loki::AllowConversion, Loki::NoCheck, Loki::DefaultSPStorage > | LoggerSmartPtr |
Logger smart pointer. | |
typedef std::list< Logger * > | LoggerList |
typedef void(* | ConfigureLoggerFunction )(const std::string &loggerName) |
Public Member Functions | |
virtual LoggerSmartPtr | getLogger (const std::string &loggerName)=0 |
int | getLocalLevel () |
int | getRemoteLevel () |
int | getLocalLevel (const std::string &loggerName) |
int | getRemoteLevel (const std::string &loggerName) |
virtual std::string | getName () const |
virtual | ~Logger () |
virtual void | addHandler (Handler::HandlerSmartPtr newHandler_p) |
virtual bool | removeHandler (const std::string &handlerName) |
virtual void | log (const LogRecord &lr) |
Overridden. Invokes the log method of registered Handler objects. | |
virtual void | log (Priority priority, const std::string &message, const std::string &file, unsigned long line, const std::string &method) |
virtual void | log (Priority priority, const std::string &message) |
virtual void | setName (const std::string &newName) |
virtual void | setLevels (Priority remotePriority, Priority localPriority, int type) |
virtual void | setLevels (const std::string &loggerName, Priority remotePriority, Priority localPriority, int type) |
void | setLevelsLoggerHandlers (Priority remotePriority, Priority localPriority, int type) |
virtual bool | exists (const std::string &loggerName) |
virtual std::list< std::string > | getLoggerNames () |
Static Public Member Functions | |
static LoggerSmartPtr | getAnonymousLogger () |
static void | setAnonymousLogger (LoggerSmartPtr anonyLogger) |
static LoggerSmartPtr | getStaticLogger () |
static void | setStaticLogger (LoggerSmartPtr anonyLogger) |
static LoggerSmartPtr | getGlobalLogger () |
static void | setGlobalLogger (LoggerSmartPtr globalLogger) |
static void | setConfigureLoggerFunction (ConfigureLoggerFunction configureLoggerFunction) |
static void | configureLogger (const std::string &loggerName) |
Protected Member Functions | |
Logger (const std::string &loggerName) | |
virtual void | acquireHandlerMutex () |
virtual void | releaseHandlerMutex () |
Private Attributes | |
std::string | loggerName_m |
std::list < Handler::HandlerSmartPtr > | handlers_m |
Static Private Attributes | |
static ACE_Thread_Mutex | loggersMutex_m |
static ConfigureLoggerFunction | configureLoggerFunction_m |
Logger is an abstract class which provides the interface used to log messages and errors throughout ALMA software. This class assumes nothing about the ACS logging service and is based in part on the implementation of the Java Logger interface.
typedef void(* Logging::Logger::ConfigureLoggerFunction)(const std::string &loggerName) |
typedef std::list<Logger*> Logging::Logger::LoggerList |
typedef Loki::SmartPtr<Logger, Loki::RefCountedMTAdj<Loki::ObjectLevelLockable>::RefCountedMT, Loki::AllowConversion, Loki::NoCheck, Loki::DefaultSPStorage> Logging::Logger::LoggerSmartPtr |
Logger smart pointer.
virtual Logging::Logger::~Logger | ( | ) | [virtual] |
Destructor.
Logging::Logger::Logger | ( | const std::string & | loggerName | ) | [protected] |
Constructor.
loggerName | A name for the logger. This should be a dot-separated name and should normally be based on the container/ component/client name. |
virtual void Logging::Logger::acquireHandlerMutex | ( | ) | [inline, protected, virtual] |
Mmethod used to facilitate logging within a multi-threaded environment. Subclasses should override this method with code used to acquire a mutual exclusion lock. The developer is free to use any type of mutex they prefer (e.g., ACE_Thread_Mutex for example).
Reimplemented in Logging::ACSLogger.
virtual void Logging::Logger::addHandler | ( | Handler::HandlerSmartPtr | newHandler_p | ) | [virtual] |
static void Logging::Logger::configureLogger | ( | const std::string & | loggerName | ) | [inline, static] |
Configure logger.
References configureLoggerFunction_m.
virtual bool Logging::Logger::exists | ( | const std::string & | loggerName | ) | [virtual] |
static LoggerSmartPtr Logging::Logger::getAnonymousLogger | ( | ) | [static] |
static LoggerSmartPtr Logging::Logger::getGlobalLogger | ( | ) | [static] |
int Logging::Logger::getLocalLevel | ( | const std::string & | loggerName | ) |
int Logging::Logger::getLocalLevel | ( | ) |
virtual LoggerSmartPtr Logging::Logger::getLogger | ( | const std::string & | loggerName | ) | [pure virtual] |
Create a logger for a named subsystem. This method is pure abstract requiring subclasses to return an instance of their own subclass.
loggerName | Name of the logger desired (i.e., "POWER_SUPPLY1") |
Implemented in Logging::ACSLogger, and Logging::GenericLogger.
virtual std::list<std::string> Logging::Logger::getLoggerNames | ( | ) | [virtual] |
Get all logger names.
virtual std::string Logging::Logger::getName | ( | ) | const [virtual] |
Retrieves the name (usually a container/component/client/) of this Logger instance
Implements Logging::BaseLog.
int Logging::Logger::getRemoteLevel | ( | const std::string & | loggerName | ) |
int Logging::Logger::getRemoteLevel | ( | ) |
static LoggerSmartPtr Logging::Logger::getStaticLogger | ( | ) | [static] |
Static method used to get the Logger object for logging from static methods. getStaticLogger() is used in ACS_STATIC_XXX macros
virtual void Logging::Logger::log | ( | Priority | priority, | |
const std::string & | message | |||
) | [inline, virtual] |
This signature of log is provided as a pure convenience to developers not wishing to deal with the file name, line number, etc.
priority | Priority of the log | |
message | Log message. |
References Logging::BaseLog::FIELD_UNAVAILABLE, and log().
virtual void Logging::Logger::log | ( | Priority | priority, | |
const std::string & | message, | |||
const std::string & | file, | |||
unsigned long | line, | |||
const std::string & | method | |||
) | [inline, virtual] |
Overridden. For some reason this signature of "log" cannot be resolved from BaseLog. As a result, it must be defined here and just delegates to BaseLog
Reimplemented from Logging::BaseLog.
References log().
virtual void Logging::Logger::log | ( | const LogRecord & | lr | ) | [virtual] |
Overridden. Invokes the log method of registered Handler objects.
Implements Logging::BaseLog.
Referenced by log().
virtual void Logging::Logger::releaseHandlerMutex | ( | ) | [inline, protected, virtual] |
Method used to facilitate logging within a multi-threaded environment. Subclasses should override this method with code used to release a mutual exclusion lock. The developer is free to use any type of mutex they prefer (e.g., ACE_Thread_Mutex for example).
Reimplemented in Logging::ACSLogger.
virtual bool Logging::Logger::removeHandler | ( | const std::string & | handlerName | ) | [virtual] |
static void Logging::Logger::setAnonymousLogger | ( | LoggerSmartPtr | anonyLogger | ) | [static] |
static void Logging::Logger::setConfigureLoggerFunction | ( | ConfigureLoggerFunction | configureLoggerFunction | ) | [inline, static] |
Set logger configuration function.
References configureLoggerFunction_m.
static void Logging::Logger::setGlobalLogger | ( | LoggerSmartPtr | globalLogger | ) | [static] |
Static method used to set the global Logger object.
The | global Logger. |
Referenced by ACSDaemonServiceImpl< T >::ACSDaemonServiceImpl().
virtual void Logging::Logger::setLevels | ( | Priority | remotePriority, | |
Priority | localPriority, | |||
int | type | |||
) | [virtual] |
Set levels for local and remote logging. There levels are passed to the handlers.
virtual void Logging::Logger::setLevels | ( | const std::string & | loggerName, | |
Priority | remotePriority, | |||
Priority | localPriority, | |||
int | type | |||
) | [virtual] |
Set levels for local and remote logging of a child logger with given name. There levels are passed to the handlers.
loggerName | logger name. |
void Logging::Logger::setLevelsLoggerHandlers | ( | Priority | remotePriority, | |
Priority | localPriority, | |||
int | type | |||
) |
virtual void Logging::Logger::setName | ( | const std::string & | newName | ) | [virtual] |
Facilitates changing the name of this logger.
newName | New name for this Logger instance |
static void Logging::Logger::setStaticLogger | ( | LoggerSmartPtr | anonyLogger | ) | [static] |
ConfigureLoggerFunction Logging::Logger::configureLoggerFunction_m [static, private] |
External function that configures logger.
Referenced by configureLogger(), and setConfigureLoggerFunction().
std::list<Handler::HandlerSmartPtr> Logging::Logger::handlers_m [private] |
List of handlers which will have their "log" method invoked each time a log is received. DWF-access to this should be guarded by a mutex lock.
std::string Logging::Logger::loggerName_m [private] |
Name of this logger
ACE_Thread_Mutex Logging::Logger::loggersMutex_m [static, private] |
mutex which guards the loggers lost making this class completely thread-safe