@@ -80,36 +80,32 @@ template <typename... Ts>
8080Output (Ts&&...) -> Output<Ts...>;
8181
8282struct NullLogger {
83- constexpr static auto min_level = LogLevel::DISABLE;
84-
85- void context (Metadata const & meta, bool entered, bool async_handover) const {}
83+ static void context (Metadata const & meta, bool entered, bool async_handover) {}
8684
8785 template <LogLevel Severity, typename ... Args>
88- void emit (Metadata& meta, _impl::FormatString<Severity, Args...> fmt, Args&&... args) const {}
86+ static void emit (Metadata& meta, _impl::FormatString<Severity, Args...> fmt, Args&&... args) {}
8987};
9088
9189struct DefaultLogger {
92- constexpr static auto min_level = LogLevel::INFO;
93-
94- void context (Metadata const & meta, bool entered, bool async_handover) const {
95- if (auto * logger = current_output ()) {
90+ static void context (Metadata const & meta, bool entered, bool async_handover) {
91+ if (auto * logger = output ()) {
9692 logger->context (meta, entered, async_handover);
9793 }
9894 }
9995
10096 template <LogLevel Severity, typename ... Args>
101- void emit (Metadata& meta, _impl::FormatString<Severity, Args...> fmt, Args&&... args) const {
97+ static void emit (Metadata& meta, _impl::FormatString<Severity, Args...> fmt, Args&&... args) {
10298 auto message = fmt.make_message (std::forward<Args>(args)...);
10399 auto event = Event{.meta = meta, .text = message};
104- if (auto * logger = current_output ()) {
100+ if (auto * logger = output ()) {
105101 logger->emit (event);
106102 }
107103 }
108104
109- static LoggerBase*& current_output ();
105+ static LoggerBase*& output ();
110106 template <typename ... Sinks>
111107 static void set_output (Output<Sinks...>& logger) {
112- current_output () = &logger;
108+ output () = &logger;
113109 }
114110};
115111
0 commit comments