- log = fopen(opts.log_file, "a");
- assert(log);
- pb_log_set_stream(log);
+ log = stderr;
+ if (strcmp(opts.log_file, "-")) {
+ log = fopen(opts.log_file, "a");
+ if (!log) {
+ fprintf(stderr, "can't open log file %s, logging to "
+ "stderr\n", opts.log_file);
+ log = stderr;
+ }
+ }
+ pb_log_init(log);
+
+ if (opts.verbose == opt_yes)
+ pb_log_set_debug(true);