Ditto 4.7.0
Loading...
Searching...
No Matches
Log.hpp
1#ifndef _DITTO_LOG_
2#define _DITTO_LOG_
3
4#include "LogLevel.hpp"
5
6#include "dittoffi.hpp"
7
8#include <atomic>
9#include <string>
10
11namespace ditto {
12
17class Log {
18public:
19 typedef void (*Callback)(LogLevel, std::string);
20
21private:
22 static std::atomic<Callback> custom_log_cb;
23 static void ffi_shimmed_cb(CLogLevel_t c_log_level, char const *c_msg);
24
25public:
26 static void e(std::string const &message);
27 static void w(std::string const &message);
28 static void i(std::string const &message);
29 static void d(std::string const &message);
30 static void v(std::string const &message);
31
32 static void process_log_message(LogLevel log_level,
33 std::string const &message);
34
38 static bool get_logging_enabled();
39
46 static void set_logging_enabled(bool enabled);
47
52
59 static void set_emoji_log_level_headings_enabled(bool enabled);
60
64 static LogLevel get_minimum_log_level();
65
72 static void set_minimum_log_level(LogLevel log_level);
73
81 static void set_log_file(std::string const &log_file_path);
82
86 static void disable_log_file();
87
96 static void set_custom_log_cb(Callback log_cb);
97};
98} // namespace ditto
99
100#endif
Main singleton (global instance) to tweak the behavior of Ditto's logging infrastructure.
Definition Log.hpp:17
static void disable_log_file()
Disables logging to the previously set log file.
Definition Log.cpp:83
static void set_logging_enabled(bool enabled)
Definition Log.cpp:63
static LogLevel get_minimum_log_level()
Definition Log.cpp:72
static void set_emoji_log_level_headings_enabled(bool enabled)
Definition Log.cpp:68
static bool get_logging_enabled()
Definition Log.cpp:62
static void set_log_file(std::string const &log_file_path)
Registers a file path where logs will be written to, whenever Ditto wants to issue a log (on top of e...
Definition Log.cpp:79
static void set_minimum_log_level(LogLevel log_level)
Definition Log.cpp:75
static bool get_emoji_log_level_headings_enabled()
Definition Log.cpp:65
static void set_custom_log_cb(Callback log_cb)
Registers a callback for a fully customizable way of handling log "events" from the logger (on top of...
Definition Log.cpp:96
Definition Arc.hpp:11