#include <log.h>
Collaboration diagram for Log:

Public Member Functions | |
| Log () | |
| void | die (const char *s) |
| Write message and kills program. | |
| void | die () |
| Kill the program. | |
| void | exit_failure (const char *s) |
| void | exit_failure (const char *s, int errorcode) |
| void | init (const char *file, bool tostderr) |
| void | message (int level, const char *s) |
| void | message (int level, std::string &s) |
| void | debug (const char *s) |
| void | debug (string &s) |
| void | set_loglevel (int level) |
| void | perror (const char *s) |
| template<class T> | |
| Log & | operator<< (const T &t) |
| Log & | operator<< (ostream &(*op)(ostream &)) |
| Log & | devnull () |
| Log & | trace () |
| Log & | debug () |
| Log & | info () |
| Log & | warning () |
| Log & | error () |
| void | setAcceptor (LogAcceptor *la) |
| Set actual acceptor. May be 0 to set empty acceptor. | |
Private Member Functions | |
| Log & | time () |
Private Attributes | |
| LogAcceptor * | mLogAcceptor |
| may be NULL | |
| ofstream | m_logfile |
| log file | |
| int | m_level |
| current log level | |
| int | m_min_level |
| minimal level to log | |
| bool | m_tostderr |
| if true, the loging goes to stderr also | |
Provides loging to file and loging to stderr. If you want to use main log, use macros like LOGD, LOGE,... You may use this class also to create special custom log.
Using TRACE macros minihowto. First when you want to see trace output in your log files you need to define WANT_TRACE. It is good idea to define at the beginnning of each cpp file. It if then easy to select what trace you want to see and you don't have to reedit too many sources / you don't have too search too large logfile. The macros: TIN you may write this macro at the beggining of function. It produce message that execution entered the function ald also produce message when execution leave the function (The leave part is automatic. You don't need to write anything else) TVARIABLE(v) print message to log that varibale v has value v. Both name and value are printed. TPOINT Write mark to log that execution passed this point TPOINTS(s) Same as TPOINT but also add string message s LOGT return stream with level set to TRACE. So you may use operator << and write to stream anything you want. When tracing is disabled LOGT return stream with log level set to devnull so no output will be produced.
Definition at line 115 of file log.h.
|
|
Definition at line 50 of file log.cpp. References LOG_LEVEL_INFO, LOG_LEVEL_TRACE, m_min_level, m_tostderr, and mLogAcceptor. |
|
|
Definition at line 241 of file log.h. References LOG_LEVEL_DEBUG, m_level, and time(). Referenced by debug(). Here is the call graph for this function: ![]() |
|
|
Write message with debug level. '
Definition at line 187 of file log.h. References debug(). Here is the call graph for this function: ![]() |
|
|
Write message with debug level. '
Definition at line 180 of file log.h. References debug(). Here is the call graph for this function: ![]() |
|
|
Definition at line 239 of file log.h. References LOG_LEVEL_DEVNULL, and m_level. |
|
|
Kill the program. Write message die. This call never return. Definition at line 68 of file log.cpp. Referenced by die(), exit_failure(), and init(). |
|
|
Write message and kills program. This call never return.
Definition at line 79 of file log.cpp. References die(), and error(). Referenced by DIE(), get_bool(), get_double(), and get_long(). Here is the call graph for this function: ![]() |
|
|
Definition at line 244 of file log.h. References LOG_LEVEL_ERROR, m_level, and time(). Referenced by die(), exit_failure(), get_bool(), get_double(), get_long(), and perror(). Here is the call graph for this function: ![]() |
|
||||||||||||
|
Write message and explanation of errorcode.
Definition at line 96 of file log.cpp. References die(), and error(). Here is the call graph for this function: ![]() |
|
|
Write message s and add explanation of current errno
|
|
|
Definition at line 242 of file log.h. References LOG_LEVEL_INFO, m_level, and time(). Here is the call graph for this function: ![]() |
|
||||||||||||
|
Inicialize the logging system. Opens log file. Also connect to syslog.
Definition at line 114 of file log.cpp. References die(), LOGE, m_logfile, and m_tostderr. Referenced by ApplicationServer::init(), and ApplicationClient::init(). Here is the call graph for this function: ![]() |
|
||||||||||||
|
Write message with loglevel. '
Definition at line 139 of file log.cpp. References m_level. |
|
||||||||||||
|
Write message with loglevel. '
|
|
|
Operator for manipulators - like flush, endl,.. Also works with formating manipulators.
Definition at line 226 of file log.h. References LOG_LEVEL_DEVNULL, m_level, m_logfile, m_min_level, m_tostderr, and mLogAcceptor. |
|
||||||||||
|
Operator for writing to log. You should use this operator if you need to write anything to logfile.
Definition at line 206 of file log.h. References LOG_LEVEL_WARNING, m_level, m_logfile, m_min_level, m_tostderr, and mLogAcceptor. |
|
|
Behaves same as perror function but the output is better stylised. Definition at line 147 of file log.cpp. References error(). Referenced by try_get_double(), and try_get_long(). Here is the call graph for this function: ![]() |
|
|
Definition at line 193 of file log.h. References m_min_level. Referenced by ApplicationServer::init(), and ApplicationClient::init(). |
|
|
Set actual acceptor. May be 0 to set empty acceptor.
Definition at line 251 of file log.h. References mLogAcceptor. Referenced by Console::clean(), and Console::registerLog(). |
|
|
Write current time in the log file Definition at line 165 of file log.cpp. References LOG_LEVEL_ERROR, and m_level. Referenced by debug(), error(), info(), trace(), and warning(). |
|
|
Definition at line 240 of file log.h. References LOG_LEVEL_TRACE, m_level, and time(). Referenced by AutoTraceOut::~AutoTraceOut(). Here is the call graph for this function: ![]() |
|
|
Definition at line 243 of file log.h. References LOG_LEVEL_WARNING, m_level, and time(). Here is the call graph for this function: ![]() |
|
|
current log level
Definition at line 262 of file log.h. Referenced by debug(), devnull(), error(), info(), message(), operator<<(), time(), trace(), and warning(). |
|
|
log file
Definition at line 260 of file log.h. Referenced by init(), and operator<<(). |
|
|
minimal level to log
Definition at line 264 of file log.h. Referenced by Log(), operator<<(), and set_loglevel(). |
|
|
if true, the loging goes to stderr also
Definition at line 266 of file log.h. Referenced by init(), Log(), and operator<<(). |
|
|
may be NULL
Definition at line 258 of file log.h. Referenced by Log(), operator<<(), and setAcceptor(). |
1.4.5