#include <log.h>
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 |
| |
| void | SetLogLevel (LogMessageType msgType) |
| Sets the lowest level of logging that will be logged. | |
| LogMessageType | GetLogLevel () const |
| |
| const std::string | GetLogLevelString (LogMessageType msgType) const |
| |
| LogMessageType | GetLogLevelForString (const std::string &levelString) const |
| |
| 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 Log & | GetInstance () |
| static Log & | GetInstance (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. | |
The log file is formatted using html tags, therefore, any browser should display the log without any problems.
| 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.
| void dtUtil::Log::LogMessage | ( | const std::string & | source, | |
| int | line, | |||
| const std::string & | msg, | |||
| LogMessageType | msgType = LOG_INFO | |||
| ) | const |
Logs a time-stamped message.
| 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.
| 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. |
| 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.
| 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. |
| 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.
| msgType | - Type of message being displayed. (error,warning,info) | |
| source | - String identifier of the source of the message. | |
| msg | - Printf - style format string. |
| void dtUtil::Log::LogHorizRule | ( | ) |
Inserts a horizontal rule into the log file.
| bool dtUtil::Log::IsLevelEnabled | ( | LogMessageType | msgType | ) | const [inline] |
| 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.
| msgType | the new logging level |
| LogMessageType dtUtil::Log::GetLogLevel | ( | ) | const [inline] |
| const std::string dtUtil::Log::GetLogLevelString | ( | Log::LogMessageType | msgType | ) | const |
| Log::LogMessageType dtUtil::Log::GetLogLevelForString | ( | const std::string & | levelString | ) | const |
| 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:
dtUtil::Log::GetInstance().SetOutputStreamBit(dtUtil::Log::TO_FILE | dtUtil::Log::TO_CONSOLE);
| 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.