lib/log: Cleanup log API
[petitboot] / ui / twin / main-generic.c
index 99520d0adde32b040884ab5511c97e8b117eb828..649ad00121c800cb57a98d9c58ba71bbe760712f 100644 (file)
@@ -268,6 +268,7 @@ int main(int argc, char *argv[])
        int result;
        int ui_result;
        struct pbt_client *client;
+       FILE *log;
 
        result = pbt_opts_parse(&opts, argc, argv);
 
@@ -286,17 +287,13 @@ int main(int argc, char *argv[])
                return EXIT_SUCCESS;
        }
 
+       log = stderr;
        if (strcmp(opts.log_file, "-")) {
                FILE *log = fopen(opts.log_file, "a");
-
-               assert(log);
-               pb_log_set_stream(log);
-       } else
-               pb_log_set_stream(stderr);
-
-#if defined(DEBUG)
-       pb_log_always_flush(1);
-#endif
+               if (!log)
+                       log = stderr;
+       }
+       pb_log_init(log);
 
        pb_log("--- petitboot-twin ---\n");