diff options
author | greg@kroah.com <greg@kroah.com> | 2004-02-12 18:57:06 -0800 |
---|---|---|
committer | Greg KH <gregkh@suse.de> | 2005-04-26 21:32:27 -0700 |
commit | d026a35d747c0a993281408a9644ab843cf89fdd (patch) | |
tree | f9a30feb88d014e7b10154e737a1b5fdb9b3348e | |
parent | d45ea2b70c0cba69b02dae81d696a8b4c05c1771 (diff) |
[PATCH] more logging.h cleanups to be a bit more flexible.
-rw-r--r-- | logging.h | 18 | ||||
-rw-r--r-- | udev.c | 15 | ||||
-rw-r--r-- | udevd.c | 11 | ||||
-rw-r--r-- | udevinfo.c | 12 | ||||
-rw-r--r-- | udevsend.c | 11 |
5 files changed, 40 insertions, 27 deletions
@@ -57,23 +57,11 @@ } while (0) #endif -/* each program must declare this variable and function somewhere */ -extern unsigned char logname[42]; -extern int log_ok(void); - -static void log_message (int level, const char *format, ...) +extern void log_message (int level, const char *format, ...) __attribute__ ((format (printf, 2, 3))); -static inline void log_message (int level, const char *format, ...) -{ - va_list args; - if (!log_ok()) - return; - - va_start(args, format); - vsyslog(level, format, args); - va_end(args); -} +/* each program that uses syslog must declare this variable somewhere */ +extern unsigned char logname[42]; #undef init_logging static inline void init_logging(char *program_name) @@ -38,12 +38,21 @@ /* global variables */ char **main_argv; char **main_envp; -unsigned char logname[42]; -int log_ok(void) +#ifdef LOG +unsigned char logname[42]; +void log_message (int level, const char *format, ...) { - return udev_log; + va_list args; + + if (!udev_log) + return; + + va_start(args, format); + vsyslog(level, format, args); + va_end(args); } +#endif static void sig_handler(int signum) { @@ -51,12 +51,17 @@ LIST_HEAD(running_list); static void exec_queue_manager(void); static void msg_queue_manager(void); +#ifdef LOG unsigned char logname[42]; - -int log_ok(void) +void log_message (int level, const char *format, ...) { - return 1; + va_list args; + + va_start(args, format); + vsyslog(level, format, args); + va_end(args); } +#endif static void msg_dump_queue(void) { diff --git a/udevinfo.c b/udevinfo.c index 103ebce08c..44eb142709 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -38,12 +38,18 @@ char **main_argv; int main_argc; -unsigned char logname[42]; -int log_ok(void) +#ifdef LOG +unsigned char logname[42]; +void log_message (int level, const char *format, ...) { - return 1; + va_list args; + + va_start(args, format); + vsyslog(level, format, args); + va_end(args); } +#endif static int print_all_attributes(const char *path) { diff --git a/udevsend.c b/udevsend.c index b2fbcbbca6..c738fe2245 100644 --- a/udevsend.c +++ b/udevsend.c @@ -40,12 +40,17 @@ #include "udevd.h" #include "logging.h" +#ifdef LOG unsigned char logname[42]; - -int log_ok(void) +void log_message (int level, const char *format, ...) { - return 1; + va_list args; + + va_start(args, format); + vsyslog(level, format, args); + va_end(args); } +#endif static inline char *get_action(void) { |