EMAN2
|
Log defines a way to output logging information. More...
#include <log.h>
Public Types | |
enum | LogLevel { ERROR_LOG , WARNING_LOG , DEBUG_LOG , VARIABLE_LOG } |
Public Member Functions | |
int | begin (int argc, char *argv[], int ppid) |
begin() and start() are used by command-line programs More... | |
void | end (int ref, const string &file="-", const string &text="") |
void | error (const char *format,...) |
log an error message. More... | |
void | warn (const char *format,...) |
log a warning message. More... | |
void | debug (const char *format,...) |
log a debug message. More... | |
void | variable (const char *format,...) |
log a very-detailed-level debug message. More... | |
void | set_level (int level) |
void | set_logfile (const char *filename) |
set log output file. More... | |
void | loc (LogLevel level, const string &file, int linenum, const string &func) |
Static Public Member Functions | |
static Log * | logger () |
Private Member Functions | |
Log () | |
Log (const Log &) | |
~Log () | |
void | vlog (const char *format, LogLevel level, va_list arg) |
Private Attributes | |
FILE * | out |
LogLevel | log_level |
string | default_emandir |
string | default_emanlog |
string | location |
Static Private Attributes | |
static Log * | instance = 0 |
Log defines a way to output logging information.
1) The logs can either go to standard output (default), or go to a user-given file. 2) 4 verbose log levels are defined. by default, ERROR_LOG is used. 3) Typical usage: Log::logger()->set_level(Log::WARNING_LEVEL); Log::logger()->error("cannot open file");
enum EMAN::Log::LogLevel |
|
private |
Definition at line 49 of file log.cpp.
References default_emandir, default_emanlog, ERROR_LOG, location, log_level, and out.
Referenced by logger().
|
private |
int Log::begin | ( | int | argc, |
char * | argv[], | ||
int | ppid | ||
) |
begin() and start() are used by command-line programs
Definition at line 177 of file log.cpp.
References default_emandir, default_emanlog, and EMAN::Util::sbasename().
void Log::debug | ( | const char * | format, |
... | |||
) |
void Log::end | ( | int | ref, |
const string & | file = "-" , |
||
const string & | text = "" |
||
) |
void Log::error | ( | const char * | format, |
... | |||
) |
log an error message.
log level = ERROR_LOG. Its args are the same as printf().
Definition at line 156 of file log.cpp.
References ERROR_LOG, and vlog().
Referenced by EMAN::CCDNormProcessor::process_inplace().
void Log::loc | ( | LogLevel | level, |
const string & | file, | ||
int | linenum, | ||
const string & | func | ||
) |
Definition at line 88 of file log.cpp.
References EMAN::Util::int2str(), location, log_level, and EMAN::Util::sbasename().
|
static |
Definition at line 80 of file log.cpp.
References instance, and Log().
Referenced by EMAN::CCDNormProcessor::process_inplace(), and EMAN::Util::set_log_level().
void Log::set_level | ( | int | level | ) |
Definition at line 165 of file log.cpp.
References log_level.
Referenced by EMAN::CCDNormProcessor::process_inplace(), and EMAN::Util::set_log_level().
void Log::set_logfile | ( | const char * | filename | ) |
void Log::variable | ( | const char * | format, |
... | |||
) |
log a very-detailed-level debug message.
log level = VARIABLE_LOG. Its args are the same as printf().
Definition at line 132 of file log.cpp.
References VARIABLE_LOG, and vlog().
|
private |
void Log::warn | ( | const char * | format, |
... | |||
) |
log a warning message.
log level = WARNING_LOG. Its args are the same as printf().
Definition at line 148 of file log.cpp.
References vlog(), and WARNING_LOG.
|
private |
|
private |
|
private |
|
private |
|
private |