efreetd: log to file
authorSebastian Dransfeld <sebastian.dransfeld@sintef.no>
Fri, 21 Jun 2013 08:32:18 +0000 (10:32 +0200)
committerSebastian Dransfeld <sebastian.dransfeld@sintef.no>
Fri, 21 Jun 2013 08:32:18 +0000 (10:32 +0200)
Since it is started as a service

src/bin/efreet/efreetd.c

index d3f6d8c..b3b63d5 100644 (file)
@@ -2,6 +2,7 @@
 # include <config.h>
 #endif
 
+#include <stdlib.h>
 #include <sys/time.h>
 #include <sys/resource.h>
 
@@ -23,7 +24,19 @@ quit(void)
 int
 main(int argc, char *argv[])
 {
+   char buf[PATH_MAX];
+   char *path;
+   FILE *log;
+
    if (!eina_init()) return 1;
+
+   strcpy(buf, "/tmp/efreetd_XXXXXX");
+   path = mktemp(buf);
+   if (!path) return 1;
+   chmod(path, 0700);
+   log = fopen(path, "wb");
+   eina_log_print_cb_set(eina_log_print_cb_file, log);
+
    efreetd_log_dom = eina_log_domain_register("efreetd", EFREETD_DEFAULT_LOG_COLOR);
    if (efreetd_log_dom < 0)
      {