summaryrefslogtreecommitdiff
path: root/src/udev
diff options
context:
space:
mode:
Diffstat (limited to 'src/udev')
-rw-r--r--src/udev/accelerometer/accelerometer.c16
-rw-r--r--src/udev/ata_id/ata_id.c6
-rw-r--r--src/udev/cdrom_id/cdrom_id.c16
-rw-r--r--src/udev/scsi_id/scsi_id.c13
-rw-r--r--src/udev/scsi_id/scsi_serial.c1
-rw-r--r--src/udev/udevadm-settle.c1
-rw-r--r--src/udev/udevadm-test-builtin.c1
-rw-r--r--src/udev/udevadm-test.c1
-rw-r--r--src/udev/udevadm-trigger.c1
9 files changed, 24 insertions, 32 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();
diff --git a/src/udev/ata_id/ata_id.c b/src/udev/ata_id/ata_id.c
index f84281dd1a..bfde57223a 100644
--- a/src/udev/ata_id/ata_id.c
+++ b/src/udev/ata_id/ata_id.c
@@ -410,7 +410,7 @@ static void log_fn(struct udev *udev, int priority,
const char *file, int line, const char *fn,
const char *format, va_list args)
{
- vsyslog(priority, format, args);
+ log_metav(priority, file, line, fn, format, args);
}
int main(int argc, char *argv[])
@@ -435,11 +435,13 @@ int main(int argc, char *argv[])
{}
};
+ log_parse_environment();
+ log_open();
+
udev = udev_new();
if (udev == NULL)
goto exit;
- log_open();
udev_set_log_fn(udev, log_fn);
while (1) {
diff --git a/src/udev/cdrom_id/cdrom_id.c b/src/udev/cdrom_id/cdrom_id.c
index 33b2bc3331..c93a7bf8d1 100644
--- a/src/udev/cdrom_id/cdrom_id.c
+++ b/src/udev/cdrom_id/cdrom_id.c
@@ -37,19 +37,12 @@
#include "libudev.h"
#include "libudev-private.h"
-static bool debug;
-
_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);
}
/* device info */
@@ -875,11 +868,13 @@ int main(int argc, char *argv[])
int cnt;
int rc = 0;
+ log_parse_environment();
+ log_open();
+
udev = udev_new();
if (udev == NULL)
goto exit;
- log_open();
udev_set_log_fn(udev, log_fn);
while (1) {
@@ -900,9 +895,10 @@ int main(int argc, char *argv[])
eject = true;
break;
case 'd':
- debug = true;
+ log_set_target(LOG_TARGET_CONSOLE);
log_set_max_level(LOG_DEBUG);
udev_set_log_priority(udev, LOG_DEBUG);
+ log_open();
break;
case 'h':
printf("Usage: cdrom_id [options] <device>\n"
diff --git a/src/udev/scsi_id/scsi_id.c b/src/udev/scsi_id/scsi_id.c
index 5511df8825..4d9378a5c0 100644
--- a/src/udev/scsi_id/scsi_id.c
+++ b/src/udev/scsi_id/scsi_id.c
@@ -25,7 +25,6 @@
#include <fcntl.h>
#include <errno.h>
#include <string.h>
-#include <syslog.h>
#include <ctype.h>
#include <getopt.h>
#include <sys/stat.h>
@@ -55,7 +54,6 @@ static bool dev_specified = false;
static char config_file[MAX_PATH_LEN] = "/etc/scsi_id.config";
static enum page_code default_page_code = PAGE_UNSPECIFIED;
static int sg_version = 4;
-static int debug = 0;
static bool reformat_serial = false;
static bool export = false;
static char vendor_str[64];
@@ -70,7 +68,7 @@ static void log_fn(struct udev *udev, int priority,
const char *file, int line, const char *fn,
const char *format, va_list args)
{
- vsyslog(priority, format, args);
+ log_metav(priority, file, line, fn, format, args);
}
static void set_type(const char *from, char *to, size_t len)
@@ -390,7 +388,10 @@ static int set_options(struct udev *udev,
break;
case 'v':
- debug++;
+ log_set_target(LOG_TARGET_CONSOLE);
+ log_set_max_level(LOG_DEBUG);
+ udev_set_log_priority(udev, LOG_DEBUG);
+ log_open();
break;
case 'V':
@@ -583,11 +584,13 @@ int main(int argc, char **argv)
int newargc;
char **newargv = NULL;
+ log_parse_environment();
+ log_open();
+
udev = udev_new();
if (udev == NULL)
goto exit;
- log_open();
udev_set_log_fn(udev, log_fn);
/*
diff --git a/src/udev/scsi_id/scsi_serial.c b/src/udev/scsi_id/scsi_serial.c
index 378a73d863..b3d20a3c2d 100644
--- a/src/udev/scsi_id/scsi_serial.c
+++ b/src/udev/scsi_id/scsi_serial.c
@@ -26,7 +26,6 @@
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
-#include <syslog.h>
#include <time.h>
#include <inttypes.h>
#include <scsi/scsi.h>
diff --git a/src/udev/udevadm-settle.c b/src/udev/udevadm-settle.c
index fae8b4c6b3..ddcf1ddf9a 100644
--- a/src/udev/udevadm-settle.c
+++ b/src/udev/udevadm-settle.c
@@ -25,7 +25,6 @@
#include <errno.h>
#include <dirent.h>
#include <fcntl.h>
-#include <syslog.h>
#include <getopt.h>
#include <signal.h>
#include <time.h>
diff --git a/src/udev/udevadm-test-builtin.c b/src/udev/udevadm-test-builtin.c
index 179f269693..a300e1e9d7 100644
--- a/src/udev/udevadm-test-builtin.c
+++ b/src/udev/udevadm-test-builtin.c
@@ -23,7 +23,6 @@
#include <errno.h>
#include <dirent.h>
#include <fcntl.h>
-#include <syslog.h>
#include <getopt.h>
#include <signal.h>
#include <time.h>
diff --git a/src/udev/udevadm-test.c b/src/udev/udevadm-test.c
index 0f6cccffb5..8486049814 100644
--- a/src/udev/udevadm-test.c
+++ b/src/udev/udevadm-test.c
@@ -25,7 +25,6 @@
#include <ctype.h>
#include <fcntl.h>
#include <signal.h>
-#include <syslog.h>
#include <getopt.h>
#include <sys/signalfd.h>
diff --git a/src/udev/udevadm-trigger.c b/src/udev/udevadm-trigger.c
index 668791b7a0..a52d1b5ad5 100644
--- a/src/udev/udevadm-trigger.c
+++ b/src/udev/udevadm-trigger.c
@@ -24,7 +24,6 @@
#include <errno.h>
#include <dirent.h>
#include <fcntl.h>
-#include <syslog.h>
#include <fnmatch.h>
#include <sys/stat.h>
#include <sys/types.h>