Joedb 10.3.0
The Journal-Only Embedded Database
Loading...
Searching...
No Matches
CLog_Logger.cpp
Go to the documentation of this file.
3
4#include <iostream>
5
6namespace joedb
7{
8 std::mutex CLog_Logger::mutex;
9
10 ////////////////////////////////////////////////////////////////////////////
11 CLog_Logger::CLog_Logger(std::string tag): tag(std::move(tag))
12 {
13 }
14
15 ////////////////////////////////////////////////////////////////////////////
16 void CLog_Logger::log(const std::string &message) noexcept
17 {
18 try
19 {
20 std::unique_lock lock(mutex);
21 std::clog << joedb::get_time_string_of_now() << ' ';
22 if (!tag.empty())
23 std::clog << tag << ": ";
24 std::clog << message << '\n';
25 std::clog.flush();
26 }
27 catch (...)
28 {
29 }
30 }
31}
void log(const std::string &message) noexcept override
CLog_Logger(std::string tag="")
std::string get_time_string_of_now()