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