Template Class Log

Class Documentation

template<const char *name>
class Log

Public Functions

explicit Log(spdlog::file_event_handlers event_handlers = {}, ::CE::Logging::Config configuration = ::CE::Logging::Config::for_logger(name))
~Log() noexcept
inline const ::CE::Logging::Config &initial_configuration() const noexcept

Declaration: [[nodiscard]]

Owned immutable startup settings with an absolute directory.

Live level setters affect the current generation and are preserved by close/reopen.

inline ::CE::Logging::QueueStats shared_queue_stats() const

Declaration: [[nodiscard]]

Observe all categories using this pool, including discarded flush requests.

This is not a per-Log count or an atomic pair of values. Available while closed; does not reset the shared counters.

inline ::CE::Logging::BackendStats backend_stats() const noexcept

Declaration: [[nodiscard]]

inline void report_diagnostics() const

Emit coalesced loss/failure counters through bounded stdio outside lifecycle locks.

Available while closed; also called by completed close.

std::filesystem::path get_file_path() const

Declaration: [[nodiscard]]

uint16_t get_log_id() const

Declaration: [[nodiscard]]

void flush() const

Queue a flush with this Log’s overflow policy.

Block can wait for capacity; DiscardNew can lose the request. No backend acknowledgement is returned. Completed close releases accepted file owners after the producers have stopped; it does not promise physical durability.

void close(std::chrono::milliseconds timeout = std::chrono::milliseconds::zero())
void reopen()
void make_default() const
void set_level_logger(spdlog::level level) const
void set_level_filesink(spdlog::level level) const
void set_level_stdsink(spdlog::level level) const
inline bool should_log(const spdlog::level level) const noexcept

Declaration: [[nodiscard]]

A best-effort probe of compile, logger, and actual sink filters.

Level changes/close may race a later write; retaining the published logger here keeps this probe’s sink graph alive. The native graph is fixed. Probe before evaluating expensive log arguments.

inline void set_pattern(const char *fmt) const
inline void set_pattern_filesink(const char *fmt) const
inline void set_pattern_stdsink(const char *fmt) const
inline void strace(void *addr0 = nullptr) const
template<typename ...Args>
inline void trace(spdlog::format_string_t<Args...> fmt, Args&&... args)
template<typename ...Args>
inline void debug(spdlog::format_string_t<Args...> fmt, Args&&... args)
template<typename ...Args>
inline void info(spdlog::format_string_t<Args...> fmt, Args&&... args)
template<typename ...Args>
inline void warn(spdlog::format_string_t<Args...> fmt, Args&&... args)
template<typename ...Args>
inline void error(spdlog::format_string_t<Args...> fmt, Args&&... args)
template<typename ...Args>
inline void critical(spdlog::format_string_t<Args...> fmt, Args&&... args)
template<typename T>
std::shared_ptr<T> acquire_open_resource(const LogStateController::Lock &lock, const std::atomic<std::shared_ptr<T>> &resource, const char *operation) const

Protected Functions

template<typename T>
std::shared_ptr<T> acquire_open_resource(const LogStateController::Lock &lock, const atomic_shared_ptr<T> &resource, const char *operation) const

Declaration: [[nodiscard]]

void require_open_state(const LogStateController::Lock &lock, const char *operation) const

Protected Attributes

uint16_t log_id = 0
const spdlog::file_event_handlers event_handlers
atomic_shared_ptr<spdlog::logger> m_logger = {nullptr}
atomic_shared_ptr<spdlog::sinks::rotating_file_sink_mt> m_file = {nullptr}
atomic_shared_ptr<::CE::Logging::Sinks::ThreadSafeOutputSink> m_console = {nullptr}