diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-08-11 20:13:38 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-08-11 20:13:38 +0200 |
commit | 5168f84a29b9f0002c9d44133cc9830046bb0619 (patch) | |
tree | d5c77a10b81d84532280c77d8bd0fd316b7660bf /src/udev/accelerometer | |
parent | c1dc6153c9426d98ddbcd8b5077f397f18ff1da7 (diff) |
udev: never bypass our own logging framework and call vsyslog() directly from udev tools
Diffstat (limited to 'src/udev/accelerometer')
-rw-r--r-- | src/udev/accelerometer/accelerometer.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/udev/accelerometer/accelerometer.c b/src/udev/accelerometer/accelerometer.c index 32adf27777..4513bc63c2 100644 --- a/src/udev/accelerometer/accelerometer.c +++ b/src/udev/accelerometer/accelerometer.c @@ -69,19 +69,12 @@ #define LONG(x) ((x)/BITS_PER_LONG) #define test_bit(bit, array) ((array[LONG(bit)] >> OFF(bit)) & 1) -static int debug = 0; - _printf_(6,0) static void log_fn(struct udev *udev, int priority, const char *file, int line, const char *fn, const char *format, va_list args) { - if (debug) { - fprintf(stderr, "%s: ", fn); - vfprintf(stderr, format, args); - } else { - vsyslog(priority, format, args); - } + log_metav(priority, file, line, fn, format, args); } typedef enum { @@ -233,11 +226,13 @@ int main (int argc, char** argv) struct udev_enumerate *enumerate; struct udev_list_entry *list_entry; + log_parse_environment(); + log_open(); + udev = udev_new(); if (udev == NULL) return 1; - log_open(); udev_set_log_fn(udev, log_fn); /* CLI argument parsing */ @@ -250,9 +245,10 @@ int main (int argc, char** argv) switch (option) { case 'd': - debug = 1; + log_set_target(LOG_TARGET_CONSOLE); log_set_max_level(LOG_DEBUG); udev_set_log_priority(udev, LOG_DEBUG); + log_open(); break; case 'h': help(); |