50 explicit Logger(
QEventBus& qBus, std::string_view name,
bool createStdoutSink =
true);
52 void addSink(
const eastl::shared_ptr<LoggerSink>& sink);
53 void log(LogLevel level, std::string_view message, eastl::optional<std::source_location> location = eastl::nullopt);
55 template <
typename... Args>
56 void info(std::format_string<Args...> format, Args&&... args) {
57 log(LogLevel::INFO, std::format(format, std::forward<Args>(args)...));
60 template <
typename... Args>
61 void warn(std::format_string<Args...> format, Args&&... args) {
62 log(LogLevel::WARN, std::format(format, std::forward<Args>(args)...));
65 template <
typename... Args>
66 void error(std::format_string<Args...> format, Args&&... args) {
67 log(LogLevel::ERROR, std::format(format, std::forward<Args>(args)...));
70 template <
typename... Args>
71 void debug(std::format_string<Args...> format, Args&&... args) {
72 log(LogLevel::DEBUG, std::format(format, std::forward<Args>(args)...));
75 template <
typename... Args>
76 void info_trace(
const std::source_location& location, std::format_string<Args...> format, Args&&... args) {
77 log(LogLevel::INFO, std::format(format, std::forward<Args>(args)...), location);
80 template <
typename... Args>
81 void warn_trace(
const std::source_location& location, std::format_string<Args...> format, Args&&... args) {
82 log(LogLevel::WARN, std::format(format, std::forward<Args>(args)...), location);
85 template <
typename... Args>
86 void error_trace(
const std::source_location& location, std::format_string<Args...> format, Args&&... args) {
87 log(LogLevel::ERROR, std::format(format, std::forward<Args>(args)...), location);
90 template <
typename... Args>
91 void debug_trace(
const std::source_location& location, std::format_string<Args...> format, Args&&... args) {
92 log(LogLevel::DEBUG, std::format(format, std::forward<Args>(args)...), location);
96 static Logger& getGlobalLogger(
QEventBus& qBus);
104 static std::string getFormattedSource(
const std::source_location& location);
106 static std::string GetFormattedTime();
107 const size_t MAX_LOG_EVENTS = 10000;
110 eastl::vector<eastl::shared_ptr<LoggerSink>> sinks;