Logging::Logger

NAME
SYNOPSIS
Detailed Description
Member Typedef Documentation
Constructor & Destructor Documentation
Member Function Documentation
Member Data Documentation
Author

NAME

Logging::Logger −

SYNOPSIS

#include <loggingLogger.h>

Inherits Logging::BaseLog.

Inherited by Logging::ACSLogger [virtual], and Logging::GenericLogger [virtual].

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

Detailed Description

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.

Member Typedef Documentation

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.

Constructor & Destructor Documentation

virtual Logging::Logger::~Logger () [virtual] Destructor.

Logging::Logger::Logger (const std::string & loggerName) [protected] Constructor.

Parameters:

loggerName A name for the logger. This should be a dot-separated name and should normally be based on the container/ component/client name.

Member Function Documentation

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] Add a log Handler to receive logging messages.

By default, Loggers also send their output to their parent logger. Typically the root Logger is configured with a set of Handlers that essentially act as default handlers for all loggers.

Parameters:

newHandler_p A handler to add.

static void Logging::Logger::configureLogger (const std::string & loggerName) [inline, static] Configure logger.

virtual bool Logging::Logger::exists (const std::string & loggerName) [virtual] Logger existance check.

Parameters:

loggerName logger name.

Returns:

bool

static LoggerSmartPtr Logging::Logger::getAnonymousLogger () [static] Static method used to get a nameless Logger object.

Returns:

A Logger with an empty name.

static LoggerSmartPtr Logging::Logger::getGlobalLogger () [static] Static method used to get the global Logger object.

Returns:

The global Logger.

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.

Parameters:

loggerName Name of the logger desired (i.e., ’POWER_SUPPLY1’)

Returns:

A new Logger instance.

Implemented in Logging::ACSLogger, and Logging::GenericLogger.

virtual std::list<std::string> Logging::Logger::getLoggerNames () [virtual] Get all logger names.

Returns:

logger names.

virtual std::string Logging::Logger::getName () const [virtual] Retrieves the name (usually a container/component/client/) of this Logger instance

Returns:

The name 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

Returns:

The static Logger.

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.

Parameters:

priority Priority of the log
message
Log message.

Returns:

void

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 Logging::BaseLog::log().

virtual void Logging::Logger::log (const LogRecord & lr) [virtual]

Overridden. Invokes the log method of registered Handler objects.

Implements Logging::BaseLog.

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] Remove a log Handler.

Parameters:

handlerName is the name of the handler as returned by the the getName method of Handler objects.

Returns:

true if the Handle is found/removed and false otherwise.

static void Logging::Logger::setAnonymousLogger (LoggerSmartPtr anonyLogger) [static] Static method used to set the anonymous Logger object.

Parameters:

The anonymous Logger.

static void Logging::Logger::setConfigureLoggerFunction (ConfigureLoggerFunction configureLoggerFunction) [inline, static] Set logger configuration function.

static void Logging::Logger::setGlobalLogger (LoggerSmartPtr globalLogger) [static] Static method used to set the global Logger object.

Parameters:

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.

Returns:

void

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.

Parameters:

loggerName logger name.

Returns:

void

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.

Parameters:

newName New name for this Logger instance

Returns:

void

static void Logging::Logger::setStaticLogger (LoggerSmartPtr anonyLogger) [static] Static method used to set the static Logger object.

Parameters:

The static Logger.

Member Data Documentation

ConfigureLoggerFunction Logging::Logger::configureLoggerFunction_m [static, private] External function that configures logger.

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

Author

Generated automatically by Doxygen for ACS-2015.2 C++ API from the source code.