48 explicit Logger(
QEventBus& qBus, std::string_view name,
bool createStdoutSink =
true);
50 void addSink(
const eastl::shared_ptr<LoggerSink>& sink);
51 void log(LogLevel level, std::string_view message, eastl::optional<std::source_location> location = eastl::nullopt);
53 template <
typename... Args>
54 void info(std::format_string<Args...> format, Args&&... args) {
55 log(LogLevel::INFO, std::format(format, std::forward<Args>(args)...));
58 template <
typename... Args>
59 void warn(std::format_string<Args...> format, Args&&... args) {
60 log(LogLevel::WARN, std::format(format, std::forward<Args>(args)...));
63 template <
typename... Args>
64 void error(std::format_string<Args...> format, Args&&... args) {
65 log(LogLevel::ERROR, std::format(format, std::forward<Args>(args)...));
68 template <
typename... Args>
69 void debug(std::format_string<Args...> format, Args&&... args) {
70 log(LogLevel::DEBUG, std::format(format, std::forward<Args>(args)...));
73 template <
typename... Args>
74 void info_trace(
const std::source_location& location, std::format_string<Args...> format, Args&&... args) {
75 log(LogLevel::INFO, std::format(format, std::forward<Args>(args)...), location);
78 template <
typename... Args>
79 void warn_trace(
const std::source_location& location, std::format_string<Args...> format, Args&&... args) {
80 log(LogLevel::WARN, std::format(format, std::forward<Args>(args)...), location);
83 template <
typename... Args>
84 void error_trace(
const std::source_location& location, std::format_string<Args...> format, Args&&... args) {
85 log(LogLevel::ERROR, std::format(format, std::forward<Args>(args)...), location);
88 template <
typename... Args>
89 void debug_trace(
const std::source_location& location, std::format_string<Args...> format, Args&&... args) {
90 log(LogLevel::DEBUG, std::format(format, std::forward<Args>(args)...), location);
94 static Logger& getGlobalLogger(
QEventBus& qBus);
102 static std::string getFormattedSource(
const std::source_location& location);
104 static std::string GetFormattedTime();
105 const size_t MAX_LOG_EVENTS = 10000;
108 eastl::vector<eastl::shared_ptr<LoggerSink>> sinks;