Maze Builder Docs
8.10.23
Loading...
Searching...
No Matches
async_logger.h
1
#ifndef ASYNC_LOGGER_H
2
#define ASYNC_LOGGER_H
3
4
#include <functional>
5
#include <memory>
6
#include <string_view>
7
#include <utility>
8
9
#include <
MazeBuilder/singleton_base.h
>
10
11
namespace
mazes
12
{
13
14
class
async_logger final :
public
singleton_base<async_logger>
15
{
16
friend
class
singleton_base<async_logger>;
17
public
:
18
using
sink_type = std::function<void(std::string_view)>;
19
20
async_logger();
21
~async_logger();
22
24
void
log
(std::string_view message);
25
27
void
flush
();
28
30
void
stop
() noexcept;
31
33
void
set_sink
(sink_type sink);
34
35
private:
36
class impl;
37
std::unique_ptr<impl> pimpl_;
38
};
39
}
// namespace mazes
40
41
#endif
// ASYNC_LOGGER_H
mazes::async_logger::stop
void stop() noexcept
Stop the logger.
mazes::async_logger::set_sink
void set_sink(sink_type sink)
Replace the message sink.
mazes::async_logger::flush
void flush()
Flush all pending messages.
mazes::async_logger::log
void log(std::string_view message)
Queue a message for asynchronous logging.
singleton_base.h
include
MazeBuilder
async_logger.h
Generated by
1.15.0