dtUtil::Log Class Reference

Log class which the engine uses for all of its logging needs. More...

#include <log.h>

List of all members.

Public Types

enum  LogMessageType {
  LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR,
  LOG_ALWAYS
}
 The different types of log messages. More...
enum  OutputStreamOptions { NO_OUTPUT = 0x00000000, TO_FILE = 0x00000001, TO_CONSOLE = 0x00000002, STANDARD = TO_FILE | TO_CONSOLE }

Public Member Functions

void LogMessage (const std::string &source, int line, const std::string &msg, LogMessageType msgType=LOG_INFO) const
 Logs a time-stamped message.
void LogMessage (LogMessageType msgType, const std::string &source, int line, const char *msg,...) const
 Little more sophisticated method for logging messages.
void LogMessage (LogMessageType msgType, const std::string &source, int line, const std::string &msg) const
 Little more sophisticated method for logging messages.
void LogMessage (LogMessageType msgType, const std::string &source, const char *msg,...) const
 Little more sophisticated method for logging messages.
void LogHorizRule ()
 Inserts a horizontal rule into the log file.
bool IsLevelEnabled (LogMessageType msgType) const
 
Returns:
true if log messages of the given level will be sent to the log output

void SetLogLevel (LogMessageType msgType)
 Sets the lowest level of logging that will be logged.
LogMessageType GetLogLevel () const
 
Returns:
the lowest level of logging that will be logged.

const std::string GetLogLevelString (LogMessageType msgType) const
 
Returns:
a string version of a log level.

LogMessageType GetLogLevelForString (const std::string &levelString) const
 
Returns:
the log level matching a string or WARNING if there is no match.

void SetOutputStreamBit (unsigned int option)
 Configure where the Log messages get directed.
unsigned int GetOutputStreamBit () const
 Get the currently defined output stream options.
const std::string & GetName () const
 Returns the name of this logger.

Static Public Member Functions

static LogGetInstance ()
static LogGetInstance (const std::string &name)

Protected Member Functions

 Log (const std::string &name)
 Opens the log file and writes the html header information.
 ~Log ()
 Writes any closing html tags and closes the log file.


Detailed Description

Log class which the engine uses for all of its logging needs.

The log file is formatted using html tags, therefore, any browser should display the log without any problems.


Member Enumeration Documentation

enum dtUtil::Log::LogMessageType

The different types of log messages.

Enumerator:
LOG_DEBUG 
LOG_INFO 
LOG_WARNING 
LOG_ERROR 
LOG_ALWAYS 

enum dtUtil::Log::OutputStreamOptions

Enumerator:
NO_OUTPUT  Log messages don't get written to any device.
TO_FILE  Log messages get sent to the output file.
TO_CONSOLE  Log messages get sent to the console.
STANDARD  The default setting.


Constructor & Destructor Documentation

dtUtil::Log::Log ( const std::string &  name  )  [protected]

Opens the log file and writes the html header information.

dtUtil::Log::~Log (  )  [protected]

Writes any closing html tags and closes the log file.


Member Function Documentation

void dtUtil::Log::LogMessage ( const std::string &  source,
int  line,
const std::string &  msg,
LogMessageType  msgType = LOG_INFO 
) const

Logs a time-stamped message.

Parameters:
source - String identifier of the source of the message. (__FUNCTION__ is useful here.
line the line number.
msg - Message to display.
msgType - Type of message being displayed. (error,warning,info)

void dtUtil::Log::LogMessage ( LogMessageType  msgType,
const std::string &  source,
int  line,
const char *  msg,
  ... 
) const

Little more sophisticated method for logging messages.

Allows for an unlimited number of parameters in a C-style printf syntax.

Parameters:
msgType - Type of message being displayed. (error,warning,info)
source - String identifier of the source of the message.
line - the line number.
msg - Printf - style format string.
Note:
Max length of the string to be printed is 2048 characters.

void dtUtil::Log::LogMessage ( LogMessageType  msgType,
const std::string &  source,
int  line,
const std::string &  msg 
) const

Little more sophisticated method for logging messages.

Allows for an unlimited number of parameters in a C-style printf syntax.

Parameters:
msgType - Type of message being displayed. (error,warning,info)
source - String identifier of the source of the message.
line - the line number.
msg - std::string that has been formatted.
Note:
Max length of the string to be printed is 2048 characters.

void dtUtil::Log::LogMessage ( LogMessageType  msgType,
const std::string &  source,
const char *  msg,
  ... 
) const

Little more sophisticated method for logging messages.

Allows for an unlimited number of parameters in a C-style printf syntax.

Parameters:
msgType - Type of message being displayed. (error,warning,info)
source - String identifier of the source of the message.
msg - Printf - style format string.
Note:
Max length of the string to be printed is 2048 characters.

void dtUtil::Log::LogHorizRule (  ) 

Inserts a horizontal rule into the log file.

bool dtUtil::Log::IsLevelEnabled ( LogMessageType  msgType  )  const [inline]

Returns:
true if log messages of the given level will be sent to the log output

Parameters:
msgType the type of message to query about.

void dtUtil::Log::SetLogLevel ( LogMessageType  msgType  )  [inline]

Sets the lowest level of logging that will be logged.

If the level in set to Debug, all messages will be sent. If the level is set error, only errors will be sent.

Parameters:
msgType the new logging level

LogMessageType dtUtil::Log::GetLogLevel (  )  const [inline]

Returns:
the lowest level of logging that will be logged.

const std::string dtUtil::Log::GetLogLevelString ( Log::LogMessageType  msgType  )  const

Returns:
a string version of a log level.

Log::LogMessageType dtUtil::Log::GetLogLevelForString ( const std::string &  levelString  )  const

Returns:
the log level matching a string or WARNING if there is no match.

Log & dtUtil::Log::GetInstance ( void   )  [static]

Log & dtUtil::Log::GetInstance ( const std::string &  name  )  [static]

void dtUtil::Log::SetOutputStreamBit ( unsigned int  option  ) 

Configure where the Log messages get directed.

Tell the Log where to send output messages.

The supplied parameter is a bitwise combination of OutputStreamOptions. The default is STANDARD, which directs messages to both the console and the output file. For example, to tell the Log to output to the file and console:

Parameters:
option A bitwise combination of options.

unsigned int dtUtil::Log::GetOutputStreamBit (  )  const

Get the currently defined output stream options.

const std::string& dtUtil::Log::GetName (  )  const [inline]

Returns the name of this logger.


http://www.delta3d.org
2.0.0 generated 14 Feb 2008