MayaFlux 0.2.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ write_to_stream()

template<typename Entry >
void MayaFlux::Journal::ConsoleSink::write_to_stream ( std::ostream &  os,
const Entry &  entry 
)
inlineprivate

Definition at line 45 of file ConsoleSink.hpp.

46 {
47 if (m_colors_enabled) {
48 switch (entry.severity) {
49 case Severity::TRACE:
50 os << AnsiColors::Cyan;
51 break;
52 case Severity::DEBUG:
53 os << AnsiColors::Blue;
54 break;
55 case Severity::INFO:
57 break;
58 case Severity::WARN:
60 break;
61 case Severity::ERROR:
63 break;
64 case Severity::FATAL:
66 break;
67 case Severity::NONE:
69 break;
70 default:
72 break;
73 }
74 }
75
76 os << "[" << Utils::enum_to_string(entry.severity) << "]" << AnsiColors::Reset;
77
78 os << AnsiColors::Magenta << "[" << Utils::enum_to_string(entry.component) << "]" << AnsiColors::Reset;
79
80 os << AnsiColors::Cyan << "[" << Utils::enum_to_string(entry.context) << "]" << AnsiColors::Reset << " ";
81
82 if constexpr (std::is_same_v<Entry, JournalEntry>) {
83 os << entry.message;
84 if (entry.location.file_name() != nullptr) {
85 os << AnsiColors::BrightBlue << " (" << entry.location.file_name()
86 << ":" << entry.location.line() << ")" << AnsiColors::Reset;
87 }
88 } else {
89 os << entry.message;
90 if (entry.file_name != nullptr) {
91 os << AnsiColors::BrightBlue << " (" << entry.file_name
92 << ":" << entry.line << ")" << AnsiColors::Reset;
93 }
94 }
95
96 if (m_colors_enabled) {
98 }
99
100 os << std::endl;
101 }
static constexpr std::string_view Yellow
Definition Ansi.hpp:21
static constexpr std::string_view BrightBlue
Definition Ansi.hpp:31
static constexpr std::string_view White
Definition Ansi.hpp:25
static constexpr std::string_view Blue
Definition Ansi.hpp:22
static constexpr std::string_view Reset
Definition Ansi.hpp:15
static constexpr std::string_view Green
Definition Ansi.hpp:20
static constexpr std::string_view BgRed
Definition Ansi.hpp:36
static constexpr std::string_view Cyan
Definition Ansi.hpp:24
static constexpr std::string_view BrightRed
Definition Ansi.hpp:28
static constexpr std::string_view Magenta
Definition Ansi.hpp:23
constexpr std::string_view enum_to_string(EnumType value) noexcept
Universal enum to string converter using magic_enum (original case)
Definition EnumUtils.hpp:57