BioCMAMC-ST
console.hpp
1#ifndef __LOGGER_CONSOLE_HPP__
2#define __LOGGER_CONSOLE_HPP__
3
4#include <common/logger.hpp>
5
6#include <cstdint>
7#include <ostream>
8#include <source_location>
9
10namespace IO
11{
12
18 class Console final : public Logger
19 {
20 public:
21 Console();
22 ~Console() override = default;
23
24 Console(const Console&) = delete;
25 Console(Console&&) = delete;
26 Console& operator=(const Console&) = delete;
28
29 void debug(std::string_view message) noexcept final;
30
31 void print(std::string_view prefix,
32 std::string_view message) noexcept final;
33 void alert(std::string_view prefix,
34 std::string_view message) noexcept final;
35
36 void error(std::string_view message,
37 std::source_location location
38 = std::source_location::current()) noexcept final;
39
40 void raw_log(std::string_view message) noexcept final;
41
42 void toggle_debug() noexcept final;
43 void toggle_print() noexcept final;
44 void toggle_alert() noexcept final;
45 void toggle_error() noexcept final;
46 void toggle_all() noexcept final;
47
48 // std::ostream& get_output()
49 // {
50 // return output;
51 // };
52
53 private:
54 uint32_t flags;
55 std::ostream& output;
56 std::ostream& err_output;
57
59 };
60
61} // namespace IO
62
63#endif
~Console() override=default
Console & operator=(const Console &)=delete
void error(std::string_view message, std::source_location location=std::source_location::current()) noexcept final
Log an error message with optional location details.
Definition logger.cpp:241
void toggle_error() noexcept final
Toggle the error logging behavior on or off.
Definition logger.cpp:292
void toggle_print() noexcept final
Toggle the print logging behavior on or off.
Definition logger.cpp:280
void toggle_alert() noexcept final
Toggle the alert logging behavior on or off.
Definition logger.cpp:286
void alert(std::string_view prefix, std::string_view message) noexcept final
Log an alert message with a prefix.
Definition logger.cpp:228
std::ostream & err_output
Definition console.hpp:56
void debug(std::string_view message) noexcept final
Log a debug message.
Definition logger.cpp:202
Console & operator=(Console &&)=delete
void raw_log(std::string_view message) noexcept final
Log a raw message with no additional formatting.
Definition logger.cpp:256
bool do_flush
Definition console.hpp:58
void print(std::string_view prefix, std::string_view message) noexcept final
Log a regular print message with a prefix.
Definition logger.cpp:215
void toggle_all() noexcept final
Toggle all logging types on or off.
Definition logger.cpp:274
uint32_t flags
Definition console.hpp:54
Console()
Definition logger.cpp:182
std::ostream & output
Definition console.hpp:55
void toggle_debug() noexcept final
Toggle the debug logging behavior on or off.
Definition logger.cpp:267
Console(const Console &)=delete
Console(Console &&)=delete
Logger()=default
Definition impl_post_process.hpp:11