#include <Logger.h>
Collaboration diagram for Logger:
Public Methods | |
Logger (ostream &os=cout, int iMinLogLevel=0, int iMaxLogLevel=0) | |
bool | log (int iLevel, string str) |
bool | log (int i, char *str,...) |
bool | logWithTime (int iLevel, char *str,...) |
bool | logFromSignal (int iLevel, char *str,...) |
bool | logSignal () |
void | restartTimer () |
Timing | getTiming () |
bool | isInLogLevel (int iLevel) |
bool | addLogLevel (int iLevel) |
bool | addLogRange (int iMin, int iMax) |
char * | getHeader () |
bool | setHeader (char *str) |
bool | setHeader (int i) |
bool | setHeader (int i1, int i2) |
bool | setOutputStream (ostream &os) |
ostream & | getOutputStream () |
void | showLogLevels (ostream &os) |
Private Attributes | |
Timing | m_timing |
char | m_buf [MAX_LOG_LINE] |
set< int > | m_setLogLevels |
pthread_mutex_t | mutex_stream |
char | m_strHeader [MAX_HEADER] |
ostream * | m_os |
string | m_strSignal |
Definition at line 119 of file Logger.h.
|
This is the constructor for the Logger. The output stream, the minimal and maximal log level can all be specified. The timer in this class is also restarted.
Definition at line 74 of file Logger.cpp. References addLogRange(), m_os, m_strHeader, m_timing, mutex_stream, and Timing::restartTime(). |
|
This method inserts the log level 'iLevel' to the set of logged levels. Information from this log level will be printed.
Definition at line 252 of file Logger.cpp. References m_setLogLevels. Referenced by addLogRange(), and main(). |
|
This method inserts all the log levels in the interval [iMin..iMax] to the set of logged levels.
Definition at line 263 of file Logger.cpp. References addLogLevel(). |
|
This method returns the current header that is written before the actual text that has to be logged.
Definition at line 274 of file Logger.cpp. References m_strHeader. |
|
This method returns the output stream to which the log information is written. This outputstream can be standard output (cout) or a reference to a file.
Definition at line 327 of file Logger.cpp. References m_os. |
|
Return the instance of the timing class that denotes the time the counter is running. Definition at line 232 of file Logger.cpp. References m_timing. |
|
This method returns whether the supplied log level is recorded, thus within the interval [min_log_level..max_log_level] or equal to the extra log level.
Definition at line 243 of file Logger.cpp. References m_setLogLevels. Referenced by log(), logFromSignal(), logWithTime(), Player::mainLoop(), and BasicCoach::mainLoopNormal(). |
|
This method can be used to log information. Only when the specified level of the message is part of the set of logged values the information is logged. This method receives a character string that may contain format specifiers that are also available to 'printf' (like d, f, etc.). The remaining arguments are the variables that have to be filled in at the location of the specifiers.
Definition at line 111 of file Logger.cpp. References isInLogLevel(), logSignal(), m_buf, m_os, m_strHeader, and MAX_LOG_LINE. |
|
This method can be used to log information. Only when the specified level of the message is part of the set of logged levels the information is logged. This method receives a a normal string that is logged.
Definition at line 90 of file Logger.cpp. References isInLogLevel(), m_os, and m_strHeader. Referenced by Connection::Connection(), BasicCoach::mainLoopNormal(), and stdin_callback(). |
|
This method can be used to log information. The main difference with the standard log method is that in this case the string is not printed to the output stream immediately but only at the next call of log (or logWithTime). This is a work-around for specific compiler cases in which a deadlock occurs when something is logged at the same instance by two different threads.
Definition at line 181 of file Logger.cpp. References Timing::getElapsedTime(), isInLogLevel(), m_strHeader, m_strSignal, m_timing, and MAX_LOG_LINE. |
|
This method actually writes the string that was created with logFromSignal to the specified output stream.
Definition at line 213 of file Logger.cpp. References m_os, and m_strSignal. Referenced by log(), and logWithTime(). |
|
This method can be used to log information. Only when the specified level of the message is an element in the set of logged levels the information is logged. This method receives a character string that may contain format specifiers that are also available to 'printf' (like d, f, etc.). The remaining arguments are the variables that have to be filled in at the location of the specifiers. Before the logged message the elapsed time since the timer has been restarted is printed.
Definition at line 143 of file Logger.cpp. References isInLogLevel(), logSignal(), m_buf, m_os, m_strHeader, m_timing, MAX_LOG_LINE, and Timing::printTimeDiffWithText(). |
|
This method restarts the timer associated with this Logger. Definition at line 225 of file Logger.cpp. References m_timing, and Timing::restartTime(). Referenced by main(). |
|
This method sets a predefined header that is written before the actual logging text. The header is represented by two integers which are written between parentheses, i.e. (9, 2401).
Definition at line 294 of file Logger.cpp. References m_strHeader. |
|
This method sets a predefined header that is written before the actual logging text. The header is represented by one integer which is followed by a semicolon (":") .
Definition at line 305 of file Logger.cpp. References m_strHeader. |
|
This method sets the header that is written before the actual logging text.
Definition at line 282 of file Logger.cpp. References m_strHeader. Referenced by Player::mainLoop(). |
|
This method sets the output stream to which the log information is written. This outputstream can be standard output (cout) or a reference to a file.
Definition at line 317 of file Logger.cpp. References m_os. Referenced by main(). |
|
This method outputs all the log levels that are logged to the output stream os.
Definition at line 335 of file Logger.cpp. References m_setLogLevels. Referenced by main(). |
|
buffer needed by different methods Definition at line 122 of file Logger.h. Referenced by log(), and logWithTime(). |
|
output stream to print messages to Definition at line 127 of file Logger.h. Referenced by getOutputStream(), log(), Logger(), logSignal(), logWithTime(), and setOutputStream(). |
|
set that contains all log levels Definition at line 123 of file Logger.h. Referenced by addLogLevel(), isInLogLevel(), and showLogLevels(). |
|
header string printed before msg Definition at line 126 of file Logger.h. Referenced by getHeader(), log(), logFromSignal(), Logger(), logWithTime(), and setHeader(). |
|
temporary string for other messages Definition at line 128 of file Logger.h. Referenced by logFromSignal(), and logSignal(). |
|
timer to print timing information Definition at line 121 of file Logger.h. Referenced by getTiming(), logFromSignal(), Logger(), logWithTime(), and restartTimer(). |
|
Definition at line 125 of file Logger.h. Referenced by Logger(). |