19#include <Simo/compiler/Compiler.h>
27#include "InitializationStatus.h"
31enum SIMO_PUBLIC LogLevel : std::uint8_t {
63 template <
typename Callable>
64 Logger& log_callable(
const size_t level,
const bool print_level,
70 *sink <<
'[' << level_map[level] <<
"] ";
72 *sink << std::format(
"{}", c());
76 template <
typename... Args>
77 Logger& log_format(
const size_t level,
const bool print_level, Args... args) {
82 *sink <<
'[' << level_map[level] <<
"] ";
84 *sink << std::format(std::forward<Args>(args)...);
91 static void flush_sink(
const std::filesystem::path& path);
94 static void flush_all_sinks();
97 std::filesystem::path sink_path;
98 std::ostream* sink =
nullptr;
99 bool tracked_sink =
false;
100 bool is_enabled =
false;
101 size_t current_log_level = 0;
102 std::vector<std::string> level_map;
Definition InitializationStatus.h:32
Logger & enabled(bool new_enabled_value)
Enable/disable logger.
Definition Log.cc:94
Logger & add_log_level(size_t level, std::string_view name)
Add a log level and give it a name.
Definition Log.cc:55
InitializationStatus initialize(const std::filesystem::path &sink_path_v)
Initialize the logger.
Definition Log.cc:33
static void flush_sink(const std::filesystem::path &path)
Flush sink at path if this path is identified as a used sink.
Definition Log.cc:114
Logger & populate_default_log_levels()
Setup default log levels and set default log level to the highest.
Definition Log.cc:61
Logger & log_level(LogLevel level)
Setup log level explicitly.
Definition Log.cc:72