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];