14 const config& streamConfig,
20 m_File = std::ofstream(
23 | (streamConfig.eLogFilePolicy == log_file_policy::clear_then_upend ? std::ios_base::trunc
24 : std::ios_base::app));
32 if (bufferSize.value > 0)
35 m_Buffer.resize(bytes.value);
36 m_File.rdbuf()->pubsetbuf(m_Buffer.data(), m_Buffer.size());
40 inline file_logger_stream_ofstream::~file_logger_stream_ofstream()
49 std::thread::id threadId,
50 std::chrono::system_clock::time_point messageTime,
52 string_view svFunction,
54 string_view svMessage)
58 const cstring_view svUtf8 =
to_utf8(svMessage);
59 m_File.write(svUtf8.data(),
static_cast<std::streamsize
>(svUtf8.size()));
Base class for all file logger streams.
std::filesystem::path prepare_folder_and_get_log_file_path(const config &config) noexcept
Create a folder (if required) and get log file path.
static cstring_view to_utf8(string_view svMessage)
Encode a message as UTF-8 for a byte output.
A category is a class that identifies a particular piece of code. This code can be located in differe...
file_logger_stream_ofstream(const config &streamConfig=config(), unit< size_t, units::data > bufferSize={ 8192 *sizeof(char_type), units::data::bytes })
file_logger_stream_ofstream object constructor
virtual void do_flush() override
Flush the stream.
virtual void do_log(const category &category, verbosity eVerbosity, std::thread::id threadId, std::chrono::system_clock::time_point messageTime, string_view svFile, string_view svFunction, int nLine, string_view svMessage) override
Proceed stream logging.