14namespace pixelbullet::log
26inline constexpr std::array<const char*, static_cast<size_t>(Level::count)> level_strings = {
"TRACE",
"INFO",
"WARN",
"ERROR",
29inline constexpr const char* ToString(Level level)
31 return level_strings[
static_cast<size_t>(level)];
36 std::filesystem::path root_directory;
37 std::size_t retained_session_count = 20;
38 bool allow_environment_override =
true;
43 std::string timestamp_iso8601;
45 uint32_t process_id = 0;
46 std::string thread_id;
47 Level severity = Level::Info;
48 std::string logger_name;
55 explicit Logger(std::string name);
57 [[nodiscard]]
const std::string& GetName()
const
62 template <
typename... Args>
63 void Trace(fmt::format_string<Args...> fmtStr, Args&&... args)
const
65 Write(Level::Trace, fmt::format(fmtStr, std::forward<Args>(args)...));
68 template <
typename... Args>
69 void Info(fmt::format_string<Args...> fmtStr, Args&&... args)
const
71 Write(Level::Info, fmt::format(fmtStr, std::forward<Args>(args)...));
74 template <
typename... Args>
75 void Warn(fmt::format_string<Args...> fmtStr, Args&&... args)
const
77 Write(Level::Warn, fmt::format(fmtStr, std::forward<Args>(args)...));
80 template <
typename... Args>
81 void Error(fmt::format_string<Args...> fmtStr, Args&&... args)
const
83 Write(Level::Error, fmt::format(fmtStr, std::forward<Args>(args)...));
86 template <
typename... Args>
87 void Critical(fmt::format_string<Args...> fmtStr, Args&&... args)
const
89 Write(Level::Critical, fmt::format(fmtStr, std::forward<Args>(args)...));
93 void Write(Level level, std::string message)
const;
105namespace pixelbullet::logging
109inline constexpr std::string_view core =
"core";
110inline constexpr std::string_view core_app =
"core.app";
111inline constexpr std::string_view core_graphics =
"core.graphics";
112inline constexpr std::string_view core_assets =
"core.assets";
113inline constexpr std::string_view core_shader =
"core.shader";
115inline constexpr std::string_view client =
"client";
117inline constexpr std::string_view vulkan_validation =
"vulkan.validation";
120void Initialize(
const ApplicationBootstrap& bootstrap,
const log::LogConfig& config = {});
123[[nodiscard]]
bool IsInitialized();
124[[nodiscard]] std::shared_ptr<log::Logger> Get(std::string_view name);
126void UpdateSessionMetadata(
const ApplicationSpecification& specification);
128[[nodiscard]] std::filesystem::path GetLogRoot();
129[[nodiscard]] std::filesystem::path GetSessionDirectory();
130[[nodiscard]] std::filesystem::path GetLatestManifestPath();
133namespace pixelbullet::log
135template <
typename... Args>
136void Trace(fmt::format_string<Args...> fmtStr, Args&&... args)
138 logging::Get(logging::names::core)->Trace(fmtStr, std::forward<Args>(args)...);
141template <
typename... Args>
142void Info(fmt::format_string<Args...> fmtStr, Args&&... args)
144 logging::Get(logging::names::core)->Info(fmtStr, std::forward<Args>(args)...);
147template <
typename... Args>
148void Warn(fmt::format_string<Args...> fmtStr, Args&&... args)
150 logging::Get(logging::names::core)->Warn(fmtStr, std::forward<Args>(args)...);
153template <
typename... Args>
154void Error(fmt::format_string<Args...> fmtStr, Args&&... args)
156 logging::Get(logging::names::core)->Error(fmtStr, std::forward<Args>(args)...);
159template <
typename... Args>
160void Critical(fmt::format_string<Args...> fmtStr, Args&&... args)
162 logging::Get(logging::names::core)->Critical(fmtStr, std::forward<Args>(args)...);
Definition specification.h:62
Contains configuration options for both the game and the engine.
Definition specification.h:145