#include "logs.h" int bbs_log_main( const char *syslname ) { int ret=0; char *term=NULL; pid_t pid; setlogmask (LOG_UPTO (LOG_NOTICE)); if ( syslname == NULL ) { openlog ( BBS_DEFAULT_SYSLOG, LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1); } else { openlog ( syslname, LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1 ); } //maybe fake visitor term = getenv( "TERM" ); pid = getpid(); //why it gives warning on %z? that why just typecast and hope if ( term != NULL ) syslog (LOG_NOTICE, "BBS visitor with TERM=%s pid=%d", term, (int)pid); else syslog( LOG_NOTICE, "BBS visitor pid=%d", (int)pid ); closelog (); return ret; } int bbs_log_article( const char *syslname ) { int ret=0; setlogmask (LOG_UPTO (LOG_NOTICE)); if ( syslname == NULL ) { openlog ( BBS_DEFAULT_SYSLOG, LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1); } else { openlog ( syslname, LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1 ); } //probably not fake visitor syslog( LOG_NOTICE, "BBS article" ); closelog (); return ret; } int bbs_log_article_list( const char *syslname ) { int ret=0; setlogmask (LOG_UPTO (LOG_NOTICE)); if ( syslname == NULL ) { openlog ( BBS_DEFAULT_SYSLOG, LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1); } else { openlog ( syslname, LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1 ); } //probably not fake visitor syslog( LOG_NOTICE, "BBS article list" ); closelog (); return ret; } int bbs_log_captcha( const char *syslname ) { int ret=0; setlogmask (LOG_UPTO (LOG_NOTICE)); if ( syslname == NULL ) { openlog ( BBS_DEFAULT_SYSLOG, LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1); } else { openlog ( syslname, LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1 ); } //probably not fake visitor syslog( LOG_NOTICE, "captcha passed" ); closelog (); return ret; } int bbs_log_motd( const char *syslname ) { int ret=0; setlogmask (LOG_UPTO (LOG_NOTICE)); if ( syslname == NULL ) { openlog ( BBS_DEFAULT_SYSLOG, LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1); } else { openlog ( syslname, LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1 ); } syslog( LOG_NOTICE, "BBS motd" ); closelog (); return ret; } int bbs_log_quit( const char *syslname ) { int ret=0; pid_t pid; setlogmask (LOG_UPTO (LOG_NOTICE)); if ( syslname == NULL ) { openlog ( BBS_DEFAULT_SYSLOG, LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1); } else { openlog ( syslname, LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1 ); } pid = getpid(); //why it gives warning on %z? that why just typecast and hope syslog( LOG_NOTICE, "BBS quit pid=%d", (int)pid ); closelog (); return ret; } int bbs_log( const char *syslname, const char *s ) { int ret=0; setlogmask (LOG_UPTO (LOG_NOTICE)); if ( syslname == NULL ) { openlog ( BBS_DEFAULT_SYSLOG, LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1); } else { openlog ( syslname, LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1 ); } syslog( LOG_NOTICE, "BBS: %s", s ); closelog (); return ret; }