diff --git a/include/ircd/logger.h b/include/ircd/logger.h index 95f024b5f..3830e7047 100644 --- a/include/ircd/logger.h +++ b/include/ircd/logger.h @@ -28,13 +28,10 @@ namespace ircd::log const char *reflect(const facility &); struct log; + struct vlog; + struct mark; struct console_quiet; - void vlog(const facility &, const string_view &name, const char *const &fmt, const va_rtti &ap); - void vlog(const facility &, const char *const &fmt, const va_rtti &ap); - void mark(const facility &, const string_view &msg = {}); - void mark(const string_view &msg = {}); - struct critical; struct error; struct derror; @@ -98,6 +95,18 @@ class ircd::log::log log(const string_view &name); }; +struct ircd::log::vlog +{ + vlog(const facility &, const string_view &name, const char *const &fmt, const va_rtti &ap); + vlog(const facility &, const char *const &fmt, const va_rtti &ap); +}; + +struct ircd::log::mark +{ + mark(const facility &, const string_view &msg = {}); + mark(const string_view &msg = {}); +}; + struct ircd::log::console_quiet { console_quiet(const bool &showmsg = true); diff --git a/ircd/logger.cc b/ircd/logger.cc index 72806b6bc..db8c27948 100644 --- a/ircd/logger.cc +++ b/ircd/logger.cc @@ -184,6 +184,10 @@ ircd::log::console_enabled(const facility &fac) return console_out[fac]; } +// +// console quiet +// + ircd::log::console_quiet::console_quiet(const bool &showmsg) { if(showmsg) @@ -207,6 +211,30 @@ ircd::log::console_quiet::~console_quiet() std::copy(begin(quieted_err), end(quieted_err), begin(console_err)); } +// +// mark +// + +ircd::log::mark::mark(const string_view &msg) +{ + for_each([&msg] + (const auto &fac) + { + mark(fac, msg); + }); +} + +ircd::log::mark::mark(const facility &fac, + const string_view &msg) +{ + static const auto name{"*"s}; + vlog(fac, name, "%s", msg); +} + +// +// log +// + ircd::log::log::log(const string_view &name) :log{name, '\0'} { @@ -219,23 +247,9 @@ ircd::log::log::log(const string_view &name, { } -void -ircd::log::mark(const string_view &msg) -{ - for_each([&msg] - (const auto &fac) - { - mark(fac, msg); - }); -} - -void -ircd::log::mark(const facility &fac, - const string_view &msg) -{ - static const auto name{"*"s}; - vlog(fac, name, "%s", msg); -} +// +// vlog +// namespace ircd::log { @@ -270,20 +284,18 @@ ircd::log::vlog_threadsafe(const facility &fac, }); } -void -ircd::log::vlog(const facility &fac, - const char *const &fmt, - const va_rtti &ap) +ircd::log::vlog::vlog(const facility &fac, + const char *const &fmt, + const va_rtti &ap) { static const auto name{"ircd"s}; vlog(fac, name, fmt, ap); } -void -ircd::log::vlog(const facility &fac, - const string_view &name, - const char *const &fmt, - const va_rtti &ap) +ircd::log::vlog::vlog(const facility &fac, + const string_view &name, + const char *const &fmt, + const va_rtti &ap) { if(!is_main_thread()) {