summaryrefslogtreecommitdiffstats
path: root/ui/twin/main-generic.c
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2013-09-19 12:18:56 +0800
committerJeremy Kerr <jk@ozlabs.org>2013-09-19 21:36:32 +0800
commit307b4b091e0bc298964e90888bf179431e32c134 (patch)
tree47cc758b0929eb29a216efd945b9ad46f4ffb19a /ui/twin/main-generic.c
parente52b37c27c267c882d82cd1e34412817b5a4dbce (diff)
downloadtalos-petitboot-307b4b091e0bc298964e90888bf179431e32c134.tar.gz
talos-petitboot-307b4b091e0bc298964e90888bf179431e32c134.zip
lib/log: Cleanup log API
Rather than exposing log internals (through always_flush and set_stream), do all logging init through pb_log_init(). If pb_log_init() hasn't been called, pb_log will drop messages. Also, add a pb_debug() function, specifically for debugging information. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'ui/twin/main-generic.c')
-rw-r--r--ui/twin/main-generic.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/ui/twin/main-generic.c b/ui/twin/main-generic.c
index 99520d0..649ad00 100644
--- a/ui/twin/main-generic.c
+++ b/ui/twin/main-generic.c
@@ -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");
OpenPOWER on IntegriCloud