User Manual, Developers Guide and API Documentation

wns::logger Namespace Reference

Logging subsystem of WNS. More...


Classes

class  CerrOutput
class  ConsoleFormat
class  CoutOutput
class  DelimiterFormat
 Formats messages, elements are separated by a delimiter. More...
class  FileOutput
class  FormatStrategy
class  Logger
 Writes Message to logger::Master. More...
class  Master
 Base class for logging in WNS. More...
class  Message
 Messages are used in conjunction with Logger instead of simple "cout-Logging". More...
class  OutputStrategy
struct  RawMessage
class  SQLiteFormat
 Format message to be imported into SQLite. More...
class  XMLFormat
 Formats messages in XML. More...

Typedefs

typedef PyConfigViewCreator
< FormatStrategy,
FormatStrategy
FormatStrategyCreator
typedef StaticFactory
< FormatStrategyCreator
FormatStrategyFactory
typedef Creator
< OutputStrategy,
OutputStrategy
OutputStrategyCreator
typedef StaticFactory
< OutputStrategyCreator
OutputStrategyFactory

Enumerations

enum  Level {
  OFF = 0, QUIET = 1, NORMAL = 2, VERBOSE = 3,
  MAXLEVEL
}
 ENUM for better readability of logger Levels. More...


Detailed Description

WNS provides a nice logging system that supports Messages with priorities. This makes the use of "cout-Logging" obsolete. It works as follows:

  1. Create an empty Message "m"
  2. Fill "m" with information
  3. Use a Logger to send Message to MasterLogger
    1. If the Logger is disabled the Message will be dropped
    2. If the Logger is enabled the Message is sent to the MasterLogger
      1. If the MasterLogger is enabled and the priority of the Message is higher than the global logging priority the Message is processed
      2. If the MasterLogger is disabled the Message is dropped

The logging has some useful features:

  1. Each Logger can be enabled and disabled
  2. Message objects may be used like streams
  3. Supports different MasterLoggers (ConsoleLogger, FileLogger, NetLogger, ...)
  4. The whole logging system can be disabled at compile time by defining WNS_NO_LOGGING. If the logging system is disabled there is no more runtime overhead.

Motivation

For the development and usage of simulation tools it is indispensable to have a mechanism for logging of (debugging) information about the current state/actions of the programm. As an example consider a mobile station appliying power control to its links. You want to see, if your power control works, hence you insert the following line in your power control algorithm:

   class Transmitter {
   public:
    ....
    void powerControl()
    {
        ...
        std::cout << "Set new power to: " << newPower << " dBm\n";
    }
    ...
   };

Every time the algorithm is executed you will see an output like this:

   Set new power to: 32 dBm
   Set new power to: 33 dBm
   Set new power to: 34 dBm
   Set new power to: 33 dBm
   

This is quite nice if you have only few logging messages. But with an increasing number of entities logging in such a way a number of problems appear:

  1. You can't see which entity (station) has generated the output.

  2. The simulation time when the output was generated is often of interest.

  3. You might want to disable certain logging output because it bloats your ouput with (at this moment) useless information.

  4. You need this output only if you're currently debugging your simulator. In case your simulating (what you should aim at) this output is not only useless, but it slows your simulation significantly down.

  5. You might want to redirect your logging output to something different but stdout.

Usage

Therefore a logging system has been created which tackles all these issues. In the following the usage of the system will be explained.

In order to use the logging service you need to know two things:

  1. How is the stuff used in C++?

  2. How is the stuff configured in PyConfig?

More to come ;)

Todo:
Finalize documentation ... :)

Typedef Documentation

Definition at line 69 of file FormatStrategy.hpp.

Definition at line 70 of file FormatStrategy.hpp.

Definition at line 46 of file OutputStrategy.hpp.

Definition at line 47 of file OutputStrategy.hpp.


Enumeration Type Documentation

Enumerator:
OFF 
QUIET 
NORMAL 
VERBOSE 
MAXLEVEL 

Definition at line 79 of file Logger.hpp.


Generated on Sun May 27 03:33:00 2012 for openWNS by  doxygen 1.5.5