Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site













SourceForge.net Logo

Classes:

 

class SystemLog

    

Provides different kinds of logging for applications. It allows to log to files,

console (both Cerr() and Cout() streams) and to Upp application log file.

Log messages are level-based, depending on severity. Eight log levels are

available, from DEBUG level to EMERGENCY one

 

Provided log levels :

 

enum Levels LDEBUG 

Used for debuggin purposes

enum Levels LINFO 

Used for not-so-important informations

enum Levels LNOTICE 

Used for important informations

enum Levels LWARNING 

Used to signal probable problems

enum Levels LERROR 

Indicates error conditions

enum Levels LCRITICAL 

Critical errors

enum Levels LALERT 

Very critical errors

enum Levels LEMERGENCY 

Emergency conditions

 

Special-purpose levels :

 

enum Levels LALLDEBUG 

Used to enable all logs including debug ones

enum Levels LALL 

Used to enable all but not debug logs

enum Levels LALLERR 

Used to enable all error-level logs

 

 

SystemLog()

~SystemLog()

Constructor and destructor. Used internally.

 

SystemLog &Open(String const &name, String const &dllPath = GetExeFilePath())

Opens the log stream(s) and resets status. Needed to be called just once on application start.

 

name                 Descriptive name, usually application name.

dllPath             For windows only, usually leaved as default

 

SystemLog &EnableCout(bool enable = true)

Enables logging on console output(Cout() stream).

 

enable             true/false, enables/disables log on stream

 

SystemLog &EnableCerr(bool enable = true)

Enables logging on console error output(Cerr() stream).

 

enable             true/false, enables/disables log on stream

 

SystemLog &EnableSysLog(bool enable = true)

Enables logging on system log file.

 

enable             true/false, enables/disables log on stream

 

SystemLog &EnableUppLog(bool enable = true)

Enables logging on Upp application log file.

 

enable             true/false, enables/disables log on stream

 

void Close()

Closes all logging streams. Usually no need to call this one.

 

SystemLog &EnableLevels(byte Levels)

Enables selected logging levels.

 

Levels                 Log levels to be enabled (can be OR-ed together).

Example :

SysLog.EnableLevels(LDEBUG | LWARNING | LERROR);

 

SystemLog &DisableLevels(byte Levels)

Disables selected logging levels.

 

Levels                 Log levels to be disabled (can be OR-ed together).

Example :

SysLog.DisableLevels(LDEBUG | LWARNING);

 

SystemLog &SetLevels(byte Levels)

Activates selected logging levels, disables unselected ones.

 

Levels                 Log levels to be activated (can be OR-ed together).

Example :

SysLog.SetLevels(LDEBUG | LWARNING);

 

SystemLog &SetLevel(Levels level)

Set active level for following log operations (see operator <<).

 

level                 Active log level (just a single level, can't be OR-ed).

Example :

SysLog.SetLevel(LDEBUG) << "a message on debug level";

 

SystemLog &operator()(Levels level)

Same as above, set active level for following log operations (see operator <<).

 

level                 Active log level (just a single level, can't be OR-ed).

Example :

SysLog(LDEBUG) << "a message on debug level";

 

SystemLog &WriteLog(Levels level, String const &message)

Shortcut for selecting a log level and outputting a message on it.

Equivalent to SetLevel(level) << message.

 

level                 Active log level (just a single level, can't be OR-ed).

message            Message to be logged.

Example :

SysLog.WriteLog(LDEBUG, "a message on debug level");

 

SystemLog &WriteLog(String const &message)

Outputs a message on active log level.

Equivalent to operator <<(message).

 

message            Message to be logged.

Example :

SysLog.WriteLog("a message on current active level");

 

SystemLog &Emergency(String const &message)

SystemLog &Alert(String const &message)

SystemLog &Critical(String const &message)

SystemLog &Error(String const &message)

SystemLog &Warning(String const &message)

SystemLog &Notice(String const &message)

SystemLog &Info(String const &message)

SystemLog &Debug(String const &message)

Shortcuts to activate a log level and output message on it

Equivalent to  SetLevel(xxxxx) << message.

 

message            Message to be logged.

Example :

SysLog.Warning("a message on warning level");

 

Globals:

 

SysLog

Global SystemLog object

All log output goes through that one.

 

Last edit by mdelfede on 05/19/2008. Do you want to contribute?. T++