1#ifndef __LOGGER_CONSOLE_HPP__
2#define __LOGGER_CONSOLE_HPP__
4#include <common/logger.hpp>
8#include <source_location>
31 void debug(std::string_view message)
noexcept final;
33 void print(std::string_view prefix,
34 std::string_view message)
noexcept final;
35 void alert(std::string_view prefix,
36 std::string_view message)
noexcept final;
38 void error(std::string_view message,
39 std::source_location location =
40 std::source_location::current()) noexcept final;
42 void raw_log(std::string_view message) noexcept final;
94 class RedirectGuard :
public std::enable_shared_from_this<RedirectGuard>
~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:198
void toggle_error() noexcept final
Toggle the error logging behavior on or off.
Definition logger.cpp:238
void toggle_print() noexcept final
Toggle the print logging behavior on or off.
Definition logger.cpp:228
void toggle_alert() noexcept final
Toggle the alert logging behavior on or off.
Definition logger.cpp:233
void alert(std::string_view prefix, std::string_view message) noexcept final
Log an alert message with a prefix.
Definition logger.cpp:188
std::ostream & err_output
Definition console.hpp:58
void debug(std::string_view message) noexcept final
Log a debug message.
Definition logger.cpp:168
Console & operator=(Console &&)=delete
void raw_log(std::string_view message) noexcept final
Log a raw message with no additional formatting.
Definition logger.cpp:209
void print(std::string_view prefix, std::string_view message) noexcept final
Log a regular print message with a prefix.
Definition logger.cpp:178
void toggle_all() noexcept final
Toggle all logging types on or off.
Definition logger.cpp:223
uint32_t flags
Definition console.hpp:56
Console()
CONSOLE.
Definition logger.cpp:151
std::ostream & output
Definition console.hpp:57
void toggle_debug() noexcept final
Toggle the debug logging behavior on or off.
Definition logger.cpp:217
Console(const Console &)=delete
Console(Console &&)=delete
std::shared_ptr< bool > active_flag
Definition console.hpp:115
RedirectHandle redirect_to_file()
Definition logger.cpp:73
void restore()
Definition logger.cpp:105
bool has_been_redirected
Definition console.hpp:110
std::optional< std::string > getCapturedOutput() const
Definition logger.cpp:132
std::stringstream buffer
Definition console.hpp:112
RedirectGuard()
Definition logger.cpp:45
int original_stdout_fd
Definition console.hpp:113
std::streambuf * coutbuf
Definition console.hpp:111
RedirectHandle redirect()
Definition logger.cpp:49
friend class RedirectHandle
Definition console.hpp:108
RedirectionType type
Definition console.hpp:91
RedirectHandle(RedirectHandle &&)=default
RedirectHandle & operator=(const RedirectHandle &)=delete
std::shared_ptr< RedirectGuard > owner_ptr
Definition console.hpp:88
std::shared_ptr< bool > active_flag
Definition console.hpp:89
RedirectHandle(const RedirectHandle &)=delete
bool owns_guard
Definition console.hpp:90
RedirectHandle(std::shared_ptr< RedirectGuard > owner, std::shared_ptr< bool > active_flag, bool owns, RedirectionType _type)
Definition logger.cpp:36
RedirectHandle & operator=(RedirectHandle &&)=default
Definition impl_post_process.hpp:11
RedirectionType
Definition console.hpp:64
@ File
Definition console.hpp:66
@ Buffer
Definition console.hpp:65