2 * log.h - Simple logging framework.
4 * Jonathan McDowell <noodles@earth.li>
6 * Copyright 2003 Project Purple
8 * $Id: log.h,v 1.2 2003/06/04 20:57:10 noodles Exp $
15 * loglevels - levels of severity for a log entry
17 * These provide various different levels of severity for a log entry. In
18 * acesending order they are:
28 * By default the log threshold is set to LOGTHING_NOTICE, meaning
29 * anything with a lower priority won't be output.
42 * initlogthing - initialize the logging module
43 * @appname: The application name to use in the log.
44 * @filename: The filename to log to. NULL means stderr.
46 * This function sets up the logging module ready to log. The appname is
47 * written as part of every log entry and the filename is the file we
48 * should log to. If the appname is NULL then none is written. If the
49 * filename is NULL all output is sent to stderr.
51 int initlogthing(const char *appname, const char *filename);
54 * cleanuplogthing - clean up the logging module
56 * This function cleans up the logging module after use.
58 void cleanuplogthing(void);
61 * setlogthreshold - set the threshold for log output
62 * @loglevel: The minimum log level we should output
64 * Sets the threshold for log output; anything logged with a log level
65 * lower than this will be silently dropped. Returns the old log threshold
68 loglevels setlogthreshold(loglevels loglevel);
71 * logthing - output a log entry
72 * @loglevel: The level of the log.
73 * @format: A format string, followed by any parameters required.
75 * This function outputs a log entry. A leading time/date stamp and a
76 * trailing newline are automatically added. The loglevel is compared to
77 * the current log threshold and if equal or above the log entry is
78 * output. The format parameter is of the same nature as that used in
81 int logthing(loglevels loglevel, const char *format, ...);
83 #endif /* __LOG_H__ */