X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2Fmoof%2Flog.cc;h=d0acf2e103334e98c99a562b8688b2f644c0a9aa;hp=e59740dd2a00e487f2ace56cc84839d1e395db98;hb=6c9943707d4f33035830eba0587a61a34eaecbc2;hpb=e9a16d767785b1a903a4466ff26265a5f7dae9e5 diff --git a/src/moof/log.cc b/src/moof/log.cc index e59740d..d0acf2e 100644 --- a/src/moof/log.cc +++ b/src/moof/log.cc @@ -81,15 +81,24 @@ std::ostream& log(std::cout); static std::ofstream null_log_; std::ostream& null_log(null_log_); -class log log_error(log::error); -class log log_warning(log::warning); -class log log_info(log::info); -class log log_debug(log::debug); + +// These objects are intentionally not deconstructed so that logging will +// still be available after this module has been cleaned up. +class log& log_error(*new class log(log::error)); +class log& log_warning(*new class log(log::warning)); +class log& log_info(*new class log(log::info)); +class log& log_debug(*new class log(log::debug)); static int log_script(script& script, enum log::level level) { - static class log* logs[] = {0, &log_error, &log_warning, &log_info, &log_debug}; + static class log* logs[] = { + 0, + &log_error, + &log_warning, + &log_info, + &log_debug + }; script::slot param = script[1];