galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
Loading...
Searching...
No Matches
LogMessage.hpp
Go to the documentation of this file.
1
7
8#ifndef GALAXY_LOGGING_LOGMESSAGE_HPP_
9#define GALAXY_LOGGING_LOGMESSAGE_HPP_
10
12
13namespace galaxy
14{
18 struct LogMessage final
19 {
23 std::string colour;
24
29
33 std::string time;
34
38 std::string file;
39
43 unsigned int line;
44
48 std::string message;
49
53 std::string trace;
54 };
55
56} // namespace galaxy
57
58template<>
59struct std::formatter<galaxy::LogMessage> : std::formatter<std::string>
60{
61 auto format(const galaxy::LogMessage& lm, format_context& ctx) const
62 {
63 return std::formatter<std::string>::format(std::format("{0}[{1}] [{3}, Ln {4}] {2}: {5}\x1b[0m", lm.colour, lm.time, lm.level, lm.file, lm.line, lm.message), ctx);
64 }
65};
66
67#endif
Timer.hpp galaxy.
Definition Timer.cpp:18
LogLevel
Used to determine filtering and colouring of log messages.
Definition LogLevel.hpp:22
Parts of a log message to be passed to sinks.
LogLevel level
Level of message.
std::string time
Timestamp of message.
std::string trace
Stack trace.
std::string file
File message occured in.
std::string message
The actual message to record.
unsigned int line
Line the message occured on.
std::string colour
ASCII colour code.
auto format(const galaxy::LogMessage &lm, format_context &ctx) const