Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members  

Qmms::Log::LogLevel Class Reference

Abstract class of static methods. More...

#include <log.hh>

List of all members.

Public Methods

virtual ~LogLevel ()
 Destructor does nothing, since class is never instantiated. More...

virtual void dummy () const=0
 This purely virtual function makes class abstract, which ensures that class can never be instantiated. More...


Static Public Methods

void addLevel (QString key, const int val)
 Adds a loglevel pair to both QMaps. More...

void showLevels ()
 Prints loglevel pairs to stdout. More...

bool isGreaterOrEqual (const QString p, const QString q)
 Compares two levels, given their strings. More...

bool isLevel (const QString key)
 Checks if a given string exists as a key in the QMap. More...

int getValue (const QString key)
 Returns int value of a loglevel, given its key. More...

QString getKey (const int value)
 Returns key of a loglevel, given its int value. More...


Private Methods

 LogLevel ()
 Constructor does nothing, and is private to ensure that class cannot be instantiated. More...


Static Private Methods

void init ()
 Initializes hashes. More...


Static Private Attributes

StrIntMap level
 QMap of log levels with QStrings as keys, ints as values. More...

IntStrMap revLevel
 QMap of reversed levels, where ints are keys and QStrings values. More...


Friends

class Hierarchy
 Make this a friend so that init method can be hidden from all others. More...


Detailed Description

Abstract class of static methods.

Never instantiated. Keeps track of six default logging levels, which are, in order:

           Fatal > Error > Warn > Notice > Info > Debug
 
Allows user to create any number of other levels using the method addLevel(). Log levels are kept track of in two QMaps, one with QStrings as keys and integers as values, the other the opposite.

A LogLevel is a key/value pair stored in a the first kind of QMap, where the key is a descriptive label (all uppercase) and the value is an integer that serves to order the level. The default values of the QMap are:

 FATAL = 600, ERROR = 500, WARN = 400, NOTICE = 300, INFO = 200, DEBUG = 100.
 
The other kind of QMap simply reverses the ordering of these pairs, i.e., 100 is the key for the value DEBUG, etc.

One can add to these lists with the addLevel method. Knock yourself out...


Constructor & Destructor Documentation

Qmms::Log::LogLevel::LogLevel   [private]
 

Constructor does nothing, and is private to ensure that class cannot be instantiated.

virtual Qmms::Log::LogLevel::~LogLevel   [virtual]
 

Destructor does nothing, since class is never instantiated.


Member Function Documentation

void Qmms::Log::LogLevel::addLevel QString    key,
const int    val
[static]
 

Adds a loglevel pair to both QMaps.

Parameters:
key  QString used as the key in levels Qmap
val  integer-value associated with key.

virtual void Qmms::Log::LogLevel::dummy   const [pure virtual]
 

This purely virtual function makes class abstract, which ensures that class can never be instantiated.

QString Qmms::Log::LogLevel::getKey const int    value [static]
 

Returns key of a loglevel, given its int value.

Parameters:
value  the integer value whose string is desired
Returns:
string associated with given integer

int Qmms::Log::LogLevel::getValue const QString    key [static]
 

Returns int value of a loglevel, given its key.

Parameters:
key  the string whose int value is desired
Returns:
integer value of the given key

void Qmms::Log::LogLevel::init   [static, private]
 

Initializes hashes.

Should only be called from Hierarchy constuctor, which is itself a private method. See Hierarchy for more details.

bool Qmms::Log::LogLevel::isGreaterOrEqual const QString    p,
const QString    q
[static]
 

Compares two levels, given their strings.

Returns true if p is greater than or equal to q.

Parameters:
p  key of level to compare.
q  key of level to compare against.
Returns:
true if p >= q, false otherwise.

bool Qmms::Log::LogLevel::isLevel const QString    key [static]
 

Checks if a given string exists as a key in the QMap.

Parameters:
key  the string to check against the keys of the QMap
Returns:
true if key is a key in the QMap, false otherwise

void Qmms::Log::LogLevel::showLevels   [static]
 

Prints loglevel pairs to stdout.

Obsolete method used for testing and should be removed.


Friends And Related Function Documentation

friend class Hierarchy [friend]
 

Make this a friend so that init method can be hidden from all others.


Member Data Documentation

StrIntMap Qmms::Log::LogLevel::level [static, private]
 

QMap of log levels with QStrings as keys, ints as values.

We refer to this simply as THE QMap of levels.

IntStrMap Qmms::Log::LogLevel::revLevel [static, private]
 

QMap of reversed levels, where ints are keys and QStrings values.


The documentation for this class was generated from the following file:
Generated on Fri Jan 3 15:04:05 2003 for QmmsLog by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001