36#include <boost/io/ios_state.hpp>
103 private boost::noncopyable
Class used to configure the filtering and logging behavior of Loggers; its use in your custom Loggers...
Utility class, each object of which wraps a given ostream and outputs discrete messages to it adorned...
const Function< void(Ostream_log_msg_writer *, const Msg_metadata &, util::String_view)> m_do_log_func
Pointer to function that log() will forward to when invoked.
static const std::vector< util::String_view > S_SEV_STRS
Mapping from Sev to its brief string description.
size_t m_last_human_friendly_time_stamp_str_sz
Length of string in m_last_human_friendly_time_stamp_str (excluding any NUL).
static const boost::chrono::system_clock::time_point S_POSIX_EPOCH
Jan 1, 1970, 00:00.
std::array< char, S_HUMAN_FRIENDLY_TIME_STAMP_MIN_SZ_TEMPLATE.size()+S_HUMAN_FRIENDLY_TIME_STAMP_REST_SZ_TEMPLATE.size()+1 > m_last_human_friendly_time_stamp_str
Buffer storing the last log() time stamp in human-friendly form, including a NUL at the end.
boost::io::ios_all_saver Ostream_state
Short-hand for an ostream state saver.
void do_log_with_human_friendly_time_stamp(const Msg_metadata &metadata, util::String_view msg)
log() implementation with time stamp = date/time with microsecond+ resolution/time zone,...
static constexpr util::String_view S_HUMAN_FRIENDLY_TIME_STAMP_REST_SZ_TEMPLATE
Example human-readable time stamp output, starting with seconds, for compile-time size calculations.
static constexpr util::String_view S_HUMAN_FRIENDLY_TIME_STAMP_MIN_SZ_TEMPLATE
Example human-readable time stamp output, up to but excluding seconds, for compile-time size calculat...
Ostream_log_msg_writer(const Config &config, std::ostream &os)
Constructs object wrapping the given ostream.
std::chrono::time_point< std::chrono::system_clock, std::chrono::seconds > m_cached_rounded_time_stamp
As used in the caching-for-perf algorithm in do_log_with_human_friendly_time_stamp(),...
void log_past_time_stamp(const Msg_metadata &metadata, util::String_view msg)
Remainder of log() functionality after either do_log_with_epoch_time_stamp() or do_log_with_human_fri...
const Config & m_config
Reference to the config object passed to constructor. See notes on thread safety.
~Ostream_log_msg_writer() noexcept
Restores formatting state of os to how it was before entry to constructor.
Ostream_state m_clean_os_state
Formatter state of m_os at construction. Used at least in destructor (as of this writing) to restore ...
void do_log_with_epoch_time_stamp(const Msg_metadata &metadata, util::String_view msg)
log() implementation with time stamp = seconds.microseconds since Epoch.
void log(const Msg_metadata &metadata, util::String_view msg)
Logs to the wrapped ostream the given message and associated metadata like severity and time stamp; p...
std::ostream & m_os
Reference to stream to which to log messages.
Flow module providing logging functionality.
Basic_string_view< char > String_view
Commonly used char-based Basic_string_view. See its doc header.