Lumiverse  2.5
A framework for creating lighting control applications
Functions | Variables
Lumiverse::Logger Namespace Reference

Logging interface. More...

Functions

void setLogFile (string name)
 Open a log file for writing to instead of writing to stdout. More...
 
string printTime ()
 Sticks the current time and date into a string. More...
 
string printLevel (LOG_LEVEL level)
 Translates the log level to a string. More...
 
void log (LOG_LEVEL level, string message)
 Logs a meesage to the output file. More...
 
void setLogLevel (LOG_LEVEL level)
 Sets the logLevel. More...
 

Variables

mutex logMutex
 
static unsigned int logLevel = 0
 Sets the minimum logging level. More...
 
static ofstream logFile
 Log file. More...
 

Detailed Description

Logging interface.

Contains functions to help control and rout Lumiverse error and status messages.

Function Documentation

void Lumiverse::Logger::log ( LOG_LEVEL  level,
string  message 
)

Logs a meesage to the output file.

Messages are formatted as: [LOG_LEVEL] Date Message

Parameters
levelLog message level
messageThe message to put in the log
string Lumiverse::Logger::printLevel ( LOG_LEVEL  level)

Translates the log level to a string.

Parameters
levelLog message level
Returns
String containing the text version of the message level
string Lumiverse::Logger::printTime ( )

Sticks the current time and date into a string.

Returns
String containing date and time.
void Lumiverse::Logger::setLogFile ( string  name)

Open a log file for writing to instead of writing to stdout.

This will append to an existing file.

Parameters
namePath to the file. Can be existing file or new file.
void Lumiverse::Logger::setLogLevel ( LOG_LEVEL  level)

Sets the logLevel.

You could just set logLevel=[level] in plain code, but if you like functions better, here it is.

Variable Documentation

ofstream Lumiverse::Logger::logFile
static

Log file.

If not specified, this logs to stdout.

unsigned int Lumiverse::Logger::logLevel = 0
static

Sets the minimum logging level.

If a message has a LOG_LEVEL less than the logLevel, it will not be output.