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

◆ format_entry()

template<typename Entry >
std::string MayaFlux::Journal::FileSink::format_entry ( const Entry &  entry)
inlineprivate

Definition at line 58 of file FileSink.hpp.

59 {
60 std::ostringstream oss;
61
62 auto time = std::chrono::system_clock::now();
63 auto time_t = std::chrono::system_clock::to_time_t(time);
64 oss << "[" << std::put_time(std::localtime(&time_t), "%Y-%m-%d %H:%M:%S") << "]";
65
66 oss << "[" << Utils::enum_to_string(entry.severity) << "]"
67 << "[" << Utils::enum_to_string(entry.component) << "]"
68 << "[" << Utils::enum_to_string(entry.context) << "] ";
69
70 if constexpr (std::is_same_v<Entry, JournalEntry>) {
71 oss << entry.message;
72 if (entry.location.file_name() != nullptr) {
73 oss << " (" << entry.location.file_name()
74 << ":" << entry.location.line() << ")";
75 }
76 } else {
77 oss << entry.message;
78 if (entry.file_name != nullptr) {
79 oss << " (" << entry.file_name
80 << ":" << entry.line << ")";
81 }
82 }
83
84 return oss.str();
85 }
constexpr std::string_view enum_to_string(EnumType value) noexcept
Universal enum to string converter using magic_enum (original case)
Definition EnumUtils.hpp:57