int main(int argc, char **argv) { char position1[255]; char position2[255]; zt_log_ty * logger; zt_log_ty * lsyslog; /* set the progname before calling syslog */ zt_progname(argv[0], STRIP_DIR); lsyslog = zt_log_syslog(); logger = zt_log_logger(lsyslog); zt_log_set_level(lsyslog, zt_log_debug); zt_log_printf( zt_log_emerg, "*emergency* message" ); zt_log_printf( zt_log_alert, "*alert* message" ); zt_log_printf( zt_log_crit, "*critical* message" ); zt_log_printf( zt_log_err, "*error* message" ); zt_log_printf( zt_log_warning, "*warning* message" ); zt_log_printf( zt_log_notice, "*notice* message" ); zt_log_printf( zt_log_info, "*info* message" ); zt_log_printf( zt_log_debug, "*debug* message" ); zt_log_set_opts(lsyslog, (ZT_LOG_RAW)); /* these need to be on the same line for the test to work */ sprintf(position1, "(%s:%d)", __FILE__, __LINE__); ZT_LOG_XDEBUG( "LOG_DEBUG" ); sprintf(position2, "(%s:%d)", __FILE__, __LINE__); ZT_LOG_DEBUG_INFO(), zt_log_lprintf(lsyslog, zt_log_debug, "lprintf with debugging"); zt_log_close(lsyslog); zt_log_logger(logger); return 0; } /* basic_tests */
static void log_atexit(void * data) { zt_log_ty * logp = data; logp = zt_log_logger(NULL); if(logp) { zt_log_close(logp); } }
zt_log_ty * zt_log_debug_logger(zt_log_ty *log) { static zt_log_ty *log_debug_ptr = NULL; static int forced = 0; if (((!log) && (!log_debug_ptr))) { log_debug_ptr = zt_log_stderr( ZT_LOG_WITH_LEVEL ); forced = 1; } if (log) { if (forced) { zt_log_close(log_debug_ptr), forced = 0; } log_debug_ptr = log; } return log_debug_ptr; }