19#define HAS_UNCAUGHT_EXCEPTIONS 1
20#include "third_party/date/date.h"
50 level_ = std::min(lFATAL, l);
56 static const std::string tags[] =
58 "ALL",
"DEBUG",
"INFO",
"",
"WARNING",
"ERROR",
"FATAL",
""
63 const auto tp(std::chrono::system_clock::now());
64 const date::year_month_day d(date::floor<date::days>(tp));
66 *
stream << date::format(
"%T", d) <<
'\t' << tags[level_] <<
'\t'
67 << os.str() << std::endl;
73 if (level_ != lOUTPUT)
74 tag =
"[" + tags[level_] +
"] ";
76 std::cout << tag << os.str() << std::endl;
91 const auto tp(std::chrono::system_clock::now());
92 const date::year_month_day d(date::floor<date::days>(tp));
94 std::ostringstream fn;
95 fn <<
base << date::format(
"_%j_%H_%M_%S", d) <<
".log";
97 stream = std::make_unique<std::ofstream>(fn.str());
static std::unique_ptr< std::ostream > stream
Optional log stream.
std::ostringstream & get(level=lOUTPUT)
Sets the logging level of a message.
log()
Creates a log object.
static void setup_stream(const std::string &base)
Sets the log::stream variable with a convenient value.
static level reporting_level
Messages with a lower level aren't logged / printed.
base_t base(const value_t &v)
A simple shortcut for casting an value_t to base_t.
The main namespace for the project.