summaryrefslogtreecommitdiff
path: root/src/accelerometer
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-08-11 20:13:38 +0200
committerAnthony G. Basile <blueness@gentoo.org>2014-08-12 14:14:22 -0400
commitc597413eb3b84b24bc532331a4ab788c656ec0e2 (patch)
tree2aae2dca20cb0bbb8fde0c1d3dca0ed998b80597 /src/accelerometer
parentba33e83c5a8eb5ea54546438d2cfcde27fd59757 (diff)
udev: never bypass our own logging framework and call vsyslog() directly from udev tools
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src/accelerometer')
-rw-r--r--src/accelerometer/accelerometer.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/accelerometer/accelerometer.c b/src/accelerometer/accelerometer.c
index c35cbcbd02..71c5b0c199 100644
--- a/src/accelerometer/accelerometer.c
+++ b/src/accelerometer/accelerometer.c
@@ -73,19 +73,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 {
@@ -237,11 +230,12 @@ int main (int argc, char** argv)
struct udev_enumerate *enumerate;
struct udev_list_entry *list_entry;
+ log_open();
+
udev = udev_new();
if (udev == NULL)
return 1;
- log_open();
udev_set_log_fn(udev, log_fn);
/* CLI argument parsing */
@@ -254,9 +248,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();