Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Logging::Logger Class Reference

#include <loggingLogger.h>

Inheritance diagram for Logging::Logger:

Inheritance graph
[legend]
Collaboration diagram for Logging::Logger:

Collaboration graph
[legend]
List of all members.

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

LoggerSmartPtr getAnonymousLogger ()
void setAnonymousLogger (LoggerSmartPtr anonyLogger)
LoggerSmartPtr getStaticLogger ()
void setStaticLogger (LoggerSmartPtr anonyLogger)
LoggerSmartPtr getGlobalLogger ()
void setGlobalLogger (LoggerSmartPtr globalLogger)
void setConfigureLoggerFunction (ConfigureLoggerFunction configureLoggerFunction)
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::HandlerSmartPtrhandlers_m

Static Private Attributes

ACE_Thread_Mutex loggersMutex_m
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.

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

LoggerSmartPtr Logging::Logger::getAnonymousLogger  )  [static]
 

Static method used to get a nameless Logger object.

Returns:
A Logger with an empty name.

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  ) 
 

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.

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.

void Logging::Logger::setAnonymousLogger LoggerSmartPtr  anonyLogger  )  [static]
 

Static method used to set the anonymous Logger object.

Parameters:
The anonymous Logger.

void Logging::Logger::setConfigureLoggerFunction ConfigureLoggerFunction  configureLoggerFunction  )  [inline, static]
 

Set logger configuration function.

void Logging::Logger::setGlobalLogger LoggerSmartPtr  globalLogger  )  [static]
 

Static method used to set the global Logger object.

Parameters:
The global Logger.

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

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

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

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


The documentation for this class was generated from the following file:
Generated on Thu Apr 30 02:37:28 2009 for ACS C++ API by doxygen 1.3.8