'''How to use Log class in EMAN2 to ~+print out error/warning/debugging information?+~''' * ~+EMAN2 use [[http://blake.bcm.edu/doxygen/classEMAN_1_1Log.html|Log class]] to handle logging. Please refer to "[[http://blake.bcm.edu/doxygen/log_8h_source.html|log.h]]".+~ * ~+The advantage to use Log class:+~ * It defines a generic way to do logging. The logging may go to either standard out, a file, or a pipe. * It may give you best performance. Log functions are defined as macros. With an option to define all macros to be void, we may make the program completely silient and remove all the IO overhead. * It allows different level of verbosity from 0-4, with 0 means completely silient, 4 means very verbose. * How to use Log: * in your main() file, set log level: Log::logger()->set_log_level(WARNING_LOG), this will determine how much information you want it to be logged; * log message in different levels: (log functions use the same argument format like printf()): {{{ LOGERR("out of memory"); LOGWARN("invalid image size"); LOGDEBUG("image mean density = %f\n", mean); LOGVAR("image size = (%d, %d, %d)\n", nx, ny, nz); }}} * To log function enter point, use ENTERFUNC; To log function exit point, use EXITFUNC. {{{ void foo() { ENTERFUNC; ...... EXITFUNC; } }}}