]> mj.ucw.cz Git - home-hw.git/commitdiff
SSR MQTT: Minor fixes of logging
authorMartin Mares <mj@ucw.cz>
Sat, 11 Aug 2018 19:59:18 +0000 (21:59 +0200)
committerMartin Mares <mj@ucw.cz>
Sat, 11 Aug 2018 19:59:18 +0000 (21:59 +0200)
ssr/turris/burrow-ssrd.c

index 93b1f2cd08ce33ece3f5555913aca71dda164f76..e0c6c4b6186157f6fcbb0ebbccc09da8a391345f 100644 (file)
@@ -15,6 +15,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <syslog.h>
 #include <time.h>
 
 #include <libusb-1.0/libusb.h>
@@ -40,7 +41,7 @@ void open_device(void)
                libusb_device *dev = devlist[i];
                if (!libusb_get_device_descriptor(dev, &desc)) {
                        if (desc.idVendor == 0x4242 && desc.idProduct == 0x0002) {
-                               msg(L_INFO, "Found SSR module at usb%d.%d\n", libusb_get_bus_number(dev), libusb_get_device_address(dev));
+                               msg(L_INFO, "Found SSR module at usb%d.%d", libusb_get_bus_number(dev), libusb_get_device_address(dev));
 
                                if (err = libusb_open(dev, &devh))
                                        die("Cannot open device: error %d", err);
@@ -180,10 +181,11 @@ static struct opt_section options = {
 
 int main(int argc UNUSED, char **argv)
 {
+       log_init(argv[0]);
        opt_parse(&options, argv+1);
 
        if (use_daemon) {
-               struct log_stream *ls = log_new_syslog("daemon", 0);
+               struct log_stream *ls = log_new_syslog("daemon", LOG_PID);
                log_set_default_stream(ls);
        }
        if (!use_debug)