2 * Sherlock Library -- Logging
4 * (c) 1997 Martin Mares, <mj@atrey.karlin.mff.cuni.cz>
16 static byte *progname = "???";
20 logit(int level, byte *msg, va_list args)
28 strftime(buf, sizeof(buf), "%d-%m-%y %H:%M:%S", tm);
29 fprintf(stderr, "%s %s [%d] <%d> ", buf, progname, pid, level);
30 vfprintf(stderr, msg, args);
42 if (msg[0] == '<' && msg[1] >= '0' && msg[1] <= '9' && msg[2] == '>')
47 logit(level, msg, args);
77 progname = basename(argv0);
82 open_log_file(byte *name)
86 int fd = open(name, O_WRONLY | O_CREAT | O_APPEND, 0666);
88 die("Unable to open log file");