# # # patch "dates.cc" # from [1223edca99a21b63136c5ec576a2b61c5bf686e2] # to [8a01802be5f9f514b73a29a9480a09d8415df3c4] # # patch "ui.cc" # from [6a29e5352e7fd49b248150574cba975dec563e35] # to [74363589c049530464a6880dc244daaf07f529cf] # ============================================================ --- dates.cc 1223edca99a21b63136c5ec576a2b61c5bf686e2 +++ dates.cc 8a01802be5f9f514b73a29a9480a09d8415df3c4 @@ -276,8 +276,6 @@ get_epoch_offset() epoch_offset = our_timegm(our_t); - L(FL("time epoch offset is %d\n") % epoch_offset); - know_epoch_offset = true; return epoch_offset; } @@ -323,6 +321,8 @@ date_t::date_t(int year, int month, int I(valid()); } +// WARNING: do not log anything within this function; since this is used in +// user_interface::output_prefix() this might lead to an indefinite loop! date_t date_t::now() { @@ -358,6 +358,8 @@ dump(date_t const & d, string & s) s = d.as_iso_8601_extended(); } +// WARNING: do not log anything within this function; since this is used in +// user_interface::output_prefix() this might lead to an indefinite loop! string date_t::as_formatted_localtime(string const & fmt) const { ============================================================ --- ui.cc 6a29e5352e7fd49b248150574cba975dec563e35 +++ ui.cc 74363589c049530464a6880dc244daaf07f529cf @@ -640,12 +640,21 @@ user_interface::output_prefix() user_interface::output_prefix() { std::string prefix; + if (timestamps_enabled) { - // FIXME: with no app pointer around we have no access to - // app.lua.get_date_format_spec() here, so we use the same format - // which f.e. also Apache uses for its log output - prefix = "[" + date_t::now().as_formatted_localtime("%a %b %d %H:%M:%S %Y") + "] "; + try { + // FIXME: with no app pointer around we have no access to + // app.lua.get_date_format_spec() here, so we use the same format + // which f.e. also Apache uses for its log output + prefix = "[" + + date_t::now().as_formatted_localtime("%a %b %d %H:%M:%S %Y") + + "] "; + } + // ensure that we do not throw an exception because we could not + // create the timestamp prefix above + catch (...) {} } + if (prog_name.empty()) { prefix += "?: "; } @@ -653,6 +662,7 @@ user_interface::output_prefix() { prefix += prog_name + ": "; } + return prefix; }