Main Page | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages | Examples

rdaLoggerFactory Class Reference

A factory for the rdaLogger objects. More...

List of all members.

Public Member Functions

virtual rdaLoggercreateLogger (const char *name)=0
 Creates a logger object.

virtual rdaLoggercreateAuditLogger (const char *name)
 Creates an audit logger object.

virtual const char * getType ()=0
 Returns a string identifier of the underlying logging mechanism.

virtual void destroy ()
 Closes the logging system and releases all related resources.


Detailed Description

A factory for the rdaLogger objects.

This is an abstract base class for various concrete logger factories. By implementing your own logger class and a corresponding logger factory you can connect the RDA logging API to a system specific message logging mechanism.

log.gif

To do this, you will need to provide implementations for the three abstract methods defined in the RDA base classes: log , createLogger , and getType . For example:

 class MyLogger : public rdaLogger
 {
  protected:

   virtual void log(LogLevel level, const char* message)
   {
     if (isLoggable(level))
     {
     // Send the message to the user specific logging mechanism
     }
   }
 };

 class MyLoggerFactory : public rdaLoggerFactory
 {
  public:

   virtual rdaLogger* createLogger(const char* name)
   {
     return new MyLogger(name);
   }

   virtual const char* getType()
   {
     return "my logging mechanism";
   }
 };

To redirect the log output to the specific mechanism, you will need to put the following code in the initialization part of your application, typically in main().

 .....
 MyLoggerFactory* factory = new MyLoggerFactory;
 rdaLogger::init(*factory);
 //
 // Now we can use RDA loggers.
 // The log output will go to the user specific logging mechanism.
 //
 rdaLogger* log = rdaLogger::getLogger("opc");
 log->info("Initializing OPC gateway");
 .....
See also:
rdaLogger

ThreadedLogger Documentation


Member Function Documentation

virtual void rdaLoggerFactory::destroy  )  [virtual]
 

Closes the logging system and releases all related resources.

Called from static rdaLogger::destroy().


The documentation for this class was generated from the following file:
RDA-2.3 documentation - 27 Jun 2007 - N.Trofimov