5 Author: Tatu Ylonen <ylo@cs.hut.fi>
7 Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
10 Created: Mon Mar 20 21:13:40 1995 ylo
12 Client-side versions of debug(), log(), etc. These print to stderr.
13 This is a stripped down version of log-server.c.
23 static LogLevel log_level = SYSLOG_LEVEL_INFO;
25 /* Initialize the log.
26 av0 program name (should be argv[0])
31 log_init(char *av0, LogLevel level, SyslogFacility ignored1, int ignored2)
35 case SYSLOG_LEVEL_QUIET:
36 case SYSLOG_LEVEL_ERROR:
37 case SYSLOG_LEVEL_FATAL:
38 case SYSLOG_LEVEL_INFO:
39 case SYSLOG_LEVEL_CHAT:
40 case SYSLOG_LEVEL_DEBUG:
49 #define MSGBUFSIZE 1024
52 do_log(LogLevel level, const char *fmt, va_list args)
54 char msgbuf[MSGBUFSIZE];
56 if (level > log_level)
58 if (level == SYSLOG_LEVEL_DEBUG)
59 fprintf(stderr, "debug: ");
60 vsnprintf(msgbuf, sizeof(msgbuf), fmt, args);
61 fprintf(stderr, "%s", msgbuf);
62 fprintf(stderr, "\r\n");