4 * Copyright (C) 2009 Dan Williams <dcbw@redhat.com>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details:
26 static int debug_on = 0;
31 do_log (int level, const char *fmt, ...)
37 if (level >= LOG_DBG && !debug_on)
41 vsnprintf (buffer, sizeof (buffer), fmt, args);
46 else if (level == LOG_MSG)
48 else if (level == LOG_DBG)
52 fprintf (logfile, "%c: %s\n", tag, buffer);
54 fprintf ((level == LOG_ERR) ? stderr : stdout, "%c: %s\n", tag, buffer);
58 log_startup (const char *path, int do_debug, int be_quiet)
68 logfile = fopen (path, "a+");
73 message ("\n**** Started: %s\n", ctime (&t));