1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00
lvm2/libdaemon/server/daemon-log.h
Petr Rockai b61be64370 libdaemon: Draft logging infrastructure.
- logging is not controlled by "levels" but by "types"; types are
  independent of each other... implementation of the usual "log level"
  user-level semantics can be simply done on top; the immediate
  application is enabling/disabling wire traffic logging independently
  of other debug data, since the former is rather bulky and can easily
  obscure almost everything else
- all logs go to "outlets", of which we currently have 2: syslog and
  stderr; which "types" go to which "outlets" is entirely configurable
2012-08-08 09:44:19 +02:00

15 lines
789 B
C

enum { DAEMON_LOG_FATAL = 0 /* usually preceding daemon death */
, DAEMON_LOG_ERROR = 1 /* something serious has happened */
, DAEMON_LOG_WARN = 2 /* something unusual has happened */
, DAEMON_LOG_INFO = 3 /* thought you might be interested */
, DAEMON_LOG_WIRE = 4 /* dump traffic on client sockets */
, DAEMON_LOG_DEBUG = 5 /* unsorted debug stuff */
};
#define DEBUG(s, x...) daemon_logf((s)->log, DAEMON_LOG_DEBUG, x)
#define DEBUG_cft(s, i, n) daemon_log_cft((s)->log, DAEMON_LOG_DEBUG, i, n)
#define WARN(s, x...) daemon_logf((s)->log, DAEMON_LOG_WARN, x)
#define INFO(s, x...) daemon_logf((s)->log, DAEMON_LOG_INFO, x)
#define ERROR(s, x...) daemon_logf((s)->log, DAEMON_LOG_ERROR, x)
#define FATAL(s, x...) daemon_logf((s)->log, DAEMON_LOG_FATAL, x)