diff options
author | Robert James Kaes <rjkaes@users.sourceforge.net> | 2001-06-02 03:09:27 +0000 |
---|---|---|
committer | Robert James Kaes <rjkaes@users.sourceforge.net> | 2001-06-02 03:09:27 +0000 |
commit | 2925b1841218ad90d0ecab84f133ffc1b86c2932 (patch) | |
tree | adb199ff0a5d0dcc9f4107e05e9bda8ed9050536 /src/log.c | |
parent | cce7ca652ccc091c7d95450d71f84d28dd996513 (diff) |
Added the code for handling selective logging.
Diffstat (limited to 'src/log.c')
-rw-r--r-- | src/log.c | 21 |
1 files changed, 20 insertions, 1 deletions
@@ -1,4 +1,4 @@ -/* $Id: log.c,v 1.4 2001-05-27 02:26:11 rjkaes Exp $ +/* $Id: log.c,v 1.5 2001-06-02 03:09:27 rjkaes Exp $ * * Logs the various messages which tinyproxy produces to either a log file or * the syslog daemon. Not much to it... @@ -38,6 +38,19 @@ static char *syslog_level[] = { #define STRING_LENGTH 800 /* + * Store the log level setting. + */ +static short int log_level = LOG_ERR; + +/* + * Set the log level for writing to the log file. + */ +void set_log_level(short int level) +{ + log_level = level; +} + +/* * This routine logs messages to either the log file or the syslog function. */ void log_message(short int level, char *fmt, ...) @@ -51,6 +64,12 @@ void log_message(short int level, char *fmt, ...) char str[STRING_LENGTH]; #endif + /* + * Figure out if we should write the message or not. + */ + if (level > log_level) + return; + va_start(args, fmt); #ifdef HAVE_SYSLOG_H |