CommonLibSSE NG
Logger.h
Go to the documentation of this file.
1 #pragma once
2 
3 #define SKSE_MAKE_SOURCE_LOGGER(a_func, a_type) \
4  \
5  template <class... Args> \
6  struct [[maybe_unused]] a_func \
7  { \
8  a_func() = delete; \
9  \
10  explicit a_func( \
11  spdlog::format_string_t<Args...> a_fmt, \
12  Args&&... a_args, \
13  std::source_location a_loc = std::source_location::current()) \
14  { \
15  spdlog::log( \
16  spdlog::source_loc{ \
17  a_loc.file_name(), \
18  static_cast<int>(a_loc.line()), \
19  a_loc.function_name() }, \
20  spdlog::level::a_type, \
21  a_fmt, \
22  std::forward<Args>(a_args)...); \
23  } \
24  }; \
25  \
26  template <class... Args> \
27  a_func(spdlog::format_string_t<Args...>, Args&&...) -> a_func<Args...>;
28 
29 namespace SKSE::log
30 {
31  SKSE_MAKE_SOURCE_LOGGER(trace, trace);
32  SKSE_MAKE_SOURCE_LOGGER(debug, debug);
36  SKSE_MAKE_SOURCE_LOGGER(critical, critical);
37 
38  [[nodiscard]] std::optional<std::filesystem::path> log_directory();
39 
40  void add_papyrus_sink(std::regex a_filter);
42 }
43 
44 #undef SKSE_MAKE_SOURCE_LOGGER
Definition: Logger.h:30
std::optional< std::filesystem::path > log_directory()
void remove_papyrus_sink()
SKSE_MAKE_SOURCE_LOGGER(trace, trace)
void add_papyrus_sink(std::regex a_filter)