diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/accelerometer/accelerometer.c | 15 | ||||
-rw-r--r-- | src/ata_id/ata_id.c | 5 | ||||
-rw-r--r-- | src/cdrom_id/cdrom_id.c | 15 | ||||
-rw-r--r-- | src/libudev/libudev-private.h | 1 | ||||
-rw-r--r-- | src/scsi_id/scsi_id.c | 12 | ||||
-rw-r--r-- | src/scsi_id/scsi_serial.c | 1 | ||||
-rw-r--r-- | src/udev/udevadm-settle.c | 1 | ||||
-rw-r--r-- | src/udev/udevadm-test-builtin.c | 1 | ||||
-rw-r--r-- | src/udev/udevadm-test.c | 1 | ||||
-rw-r--r-- | src/udev/udevadm-trigger.c | 1 |
10 files changed, 20 insertions, 33 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(); diff --git a/src/ata_id/ata_id.c b/src/ata_id/ata_id.c index b416cde39a..8ead84cf27 100644 --- a/src/ata_id/ata_id.c +++ b/src/ata_id/ata_id.c @@ -414,7 +414,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[]) @@ -439,11 +439,12 @@ int main(int argc, char *argv[]) {} }; + 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/cdrom_id/cdrom_id.c b/src/cdrom_id/cdrom_id.c index 5733ee4247..4d0e6e073a 100644 --- a/src/cdrom_id/cdrom_id.c +++ b/src/cdrom_id/cdrom_id.c @@ -41,19 +41,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 */ @@ -879,11 +872,12 @@ int main(int argc, char *argv[]) int cnt; int rc = 0; + log_open(); + udev = udev_new(); if (udev == NULL) goto exit; - log_open(); udev_set_log_fn(udev, log_fn); while (1) { @@ -904,9 +898,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/libudev/libudev-private.h b/src/libudev/libudev-private.h index 511ec5e22b..c1b631b13f 100644 --- a/src/libudev/libudev-private.h +++ b/src/libudev/libudev-private.h @@ -20,7 +20,6 @@ #ifndef _LIBUDEV_PRIVATE_H_ #define _LIBUDEV_PRIVATE_H_ -#include <syslog.h> #include <signal.h> #include <stdint.h> #include <stdbool.h> diff --git a/src/scsi_id/scsi_id.c b/src/scsi_id/scsi_id.c index 0ff95e566f..ad190552f7 100644 --- a/src/scsi_id/scsi_id.c +++ b/src/scsi_id/scsi_id.c @@ -29,7 +29,6 @@ #include <fcntl.h> #include <errno.h> #include <string.h> -#include <syslog.h> #include <ctype.h> #include <getopt.h> #include <sys/stat.h> @@ -59,7 +58,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]; @@ -74,7 +72,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) @@ -394,7 +392,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': @@ -587,11 +588,12 @@ int main(int argc, char **argv) int newargc; char **newargv = NULL; + log_open(); + udev = udev_new(); if (udev == NULL) goto exit; - log_open(); udev_set_log_fn(udev, log_fn); /* diff --git a/src/scsi_id/scsi_serial.c b/src/scsi_id/scsi_serial.c index c3f957db71..1806498503 100644 --- a/src/scsi_id/scsi_serial.c +++ b/src/scsi_id/scsi_serial.c @@ -30,7 +30,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 26dd8a97a5..0a8f535c4a 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 90ca8f2a8e..f25608c486 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> |