summaryrefslogtreecommitdiffstats
path: root/logs.c
diff options
context:
space:
mode:
authorFreeArtMan <dos21h@gmail.com>2015-01-07 21:00:59 +0900
committerFreeArtMan <dos21h@gmail.com>2015-01-07 21:00:59 +0900
commit03e459e7dff84c44644b1eccc0e00b73d846fe2a (patch)
tree00269e56bdf53906396199e22dcabe8bbee9592f /logs.c
parent0ab31d63699467d72f09327171b735ed2152bf2c (diff)
downloadmicrobbs-03e459e7dff84c44644b1eccc0e00b73d846fe2a.tar.gz
microbbs-03e459e7dff84c44644b1eccc0e00b73d846fe2a.zip
Small fixes about loging and libterm
Diffstat (limited to 'logs.c')
-rw-r--r--logs.c58
1 files changed, 54 insertions, 4 deletions
diff --git a/logs.c b/logs.c
index 0feebf7..c4b5948 100644
--- a/logs.c
+++ b/logs.c
@@ -1,9 +1,10 @@
#include "logs.h"
-int bbs_log( const char *syslname )
+int bbs_log_main( const char *syslname )
{
int ret=0;
char *term=NULL;
+ pid_t pid;
setlogmask (LOG_UPTO (LOG_NOTICE));
@@ -17,10 +18,12 @@ int bbs_log( const char *syslname )
//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", term);
+ syslog (LOG_NOTICE, "BBS visitor with TERM=%s pid=%d", term, (int)pid);
else
- syslog( LOG_NOTICE, "BBS visitor" );
+ syslog( LOG_NOTICE, "BBS visitor pid=%d", (int)pid );
closelog ();
@@ -75,6 +78,30 @@ int bbs_log_article_list( const char *syslname )
}
+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;
@@ -100,6 +127,7 @@ int bbs_log_motd( const char *syslname )
int bbs_log_quit( const char *syslname )
{
int ret=0;
+ pid_t pid;
setlogmask (LOG_UPTO (LOG_NOTICE));
@@ -111,7 +139,9 @@ int bbs_log_quit( const char *syslname )
openlog ( syslname, LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1 );
}
- syslog( LOG_NOTICE, "BBS quit" );
+ pid = getpid();
+ //why it gives warning on %z? that why just typecast and hope
+ syslog( LOG_NOTICE, "BBS quit pid=%d", (int)pid );
closelog ();
@@ -119,4 +149,24 @@ int bbs_log_quit( const char *syslname )
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;
+}