summaryrefslogtreecommitdiff
path: root/src/udev/cdrom_id/cdrom_id.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/udev/cdrom_id/cdrom_id.c')
-rw-r--r--src/udev/cdrom_id/cdrom_id.c16
1 files changed, 6 insertions, 10 deletions
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"