![]() |
Moonlight-XboxOG latest
Moonlight Xbox OG is a port of the Moonlight Game Streaming client to the original Xbox console.
|
Small in-memory logger with a ring buffer and optional sinks. More...
#include <src/logging/logger.h>
Public Member Functions | |
| void | add_sink (LogSink sink, LogLevel minimumLevel=LogLevel::trace) |
| Register an observer that receives accepted entries. | |
| std::size_t | capacity () const |
| Return the maximum number of retained entries. | |
| bool | debug (std::string category, std::string message, LogSourceLocation location=LogSourceLocation::current()) |
| Record a debug entry. | |
| LogLevel | debugger_console_minimum_level () const |
| Return the minimum level mirrored through DbgPrint() for xemu. | |
| const std::deque< LogEntry > & | entries () const |
| Return the retained entries. | |
| bool | error (std::string category, std::string message, LogSourceLocation location=LogSourceLocation::current()) |
| Record an error entry. | |
| LogLevel | file_minimum_level () const |
| Return the minimum level written to the configured file sink. | |
| bool | info (std::string category, std::string message, LogSourceLocation location=LogSourceLocation::current()) |
| Record an info entry. | |
| bool | log (LogLevel level, std::string category, std::string message, LogSourceLocation location=LogSourceLocation::current()) |
| Record a structured entry. | |
| Logger (std::size_t capacity=256, TimestampProvider timestampProvider={}) | |
| Construct a logger with the provided entry capacity. | |
| LogLevel | minimum_level () const |
| Return the minimum retained in-memory log level. | |
| void | set_debugger_console_minimum_level (LogLevel minimumLevel) |
| Set the minimum level mirrored through DbgPrint() for xemu. | |
| void | set_file_minimum_level (LogLevel minimumLevel) |
| Set the minimum level written to the configured file sink. | |
| void | set_file_sink (LogSink sink) |
| Install or replace the runtime file sink callback. | |
| void | set_minimum_level (LogLevel minimumLevel) |
| Set the minimum retained in-memory log level. | |
| void | set_startup_debug_enabled (bool enabled) |
| Enable or disable pre-splash startup output through debugPrint(). | |
| bool | should_log (LogLevel level) const |
| Return whether a log level would be recorded by any enabled sink. | |
| std::vector< LogEntry > | snapshot (LogLevel minimumLevel=LogLevel::trace) const |
| Copy retained entries at or above the requested level. | |
| bool | startup_debug_enabled () const |
| Return whether pre-splash startup output is currently enabled. | |
| bool | trace (std::string category, std::string message, LogSourceLocation location=LogSourceLocation::current()) |
| Record a trace entry. | |
| bool | warn (std::string category, std::string message, LogSourceLocation location=LogSourceLocation::current()) |
| Record a warning entry. | |
Small in-memory logger with a ring buffer and optional sinks.
|
explicit |
Construct a logger with the provided entry capacity.
| capacity | Maximum number of retained entries. |
| timestampProvider | Optional timestamp callback used for new entries. |
| void logging::Logger::add_sink | ( | LogSink | sink, |
| LogLevel | minimumLevel = LogLevel::trace ) |
Register an observer that receives accepted entries.
| sink | Callback invoked synchronously during logging. |
| minimumLevel | Entries below this level are not dispatched to the sink. |
| std::size_t logging::Logger::capacity | ( | ) | const |
Return the maximum number of retained entries.
| bool logging::Logger::debug | ( | std::string | category, |
| std::string | message, | ||
| LogSourceLocation | location = LogSourceLocation::current() ) |
Record a debug entry.
| category | Subsystem name such as ui or streaming. |
| message | User-visible message text. |
| location | Optional source location for the entry. |
| LogLevel logging::Logger::debugger_console_minimum_level | ( | ) | const |
Return the minimum level mirrored through DbgPrint() for xemu.
| const std::deque< LogEntry > & logging::Logger::entries | ( | ) | const |
Return the retained entries.
| bool logging::Logger::error | ( | std::string | category, |
| std::string | message, | ||
| LogSourceLocation | location = LogSourceLocation::current() ) |
Record an error entry.
| category | Subsystem name such as ui or streaming. |
| message | User-visible message text. |
| location | Optional source location for the entry. |
| LogLevel logging::Logger::file_minimum_level | ( | ) | const |
Return the minimum level written to the configured file sink.
| bool logging::Logger::info | ( | std::string | category, |
| std::string | message, | ||
| LogSourceLocation | location = LogSourceLocation::current() ) |
Record an info entry.
| category | Subsystem name such as ui or streaming. |
| message | User-visible message text. |
| location | Optional source location for the entry. |
| bool logging::Logger::log | ( | LogLevel | level, |
| std::string | category, | ||
| std::string | message, | ||
| LogSourceLocation | location = LogSourceLocation::current() ) |
Record a structured entry.
| level | Severity for the entry. |
| category | Subsystem name such as ui or streaming. |
| message | User-visible message text. |
| location | Optional source location for the entry. |
| LogLevel logging::Logger::minimum_level | ( | ) | const |
Return the minimum retained in-memory log level.
| void logging::Logger::set_debugger_console_minimum_level | ( | LogLevel | minimumLevel | ) |
Set the minimum level mirrored through DbgPrint() for xemu.
| minimumLevel | Entries below this level are not written to the debugger console. |
| void logging::Logger::set_file_minimum_level | ( | LogLevel | minimumLevel | ) |
Set the minimum level written to the configured file sink.
| minimumLevel | Entries below this level are not written to the file sink. |
| void logging::Logger::set_file_sink | ( | LogSink | sink | ) |
Install or replace the runtime file sink callback.
| sink | Callback invoked for entries accepted by the file minimum level. |
| void logging::Logger::set_minimum_level | ( | LogLevel | minimumLevel | ) |
Set the minimum retained in-memory log level.
| minimumLevel | Entries below this level are not stored in the ring buffer. |
| void logging::Logger::set_startup_debug_enabled | ( | bool | enabled | ) |
Enable or disable pre-splash startup output through debugPrint().
| enabled | True to mirror future log entries to the startup console. |
| bool logging::Logger::should_log | ( | LogLevel | level | ) | const |
Return whether a log level would be recorded by any enabled sink.
| level | The candidate level. |
| std::vector< LogEntry > logging::Logger::snapshot | ( | LogLevel | minimumLevel = LogLevel::trace | ) | const |
Copy retained entries at or above the requested level.
| minimumLevel | Minimum level to include in the snapshot. |
| bool logging::Logger::startup_debug_enabled | ( | ) | const |
Return whether pre-splash startup output is currently enabled.
| bool logging::Logger::trace | ( | std::string | category, |
| std::string | message, | ||
| LogSourceLocation | location = LogSourceLocation::current() ) |
Record a trace entry.
| category | Subsystem name such as ui or streaming. |
| message | User-visible message text. |
| location | Optional source location for the entry. |
| bool logging::Logger::warn | ( | std::string | category, |
| std::string | message, | ||
| LogSourceLocation | location = LogSourceLocation::current() ) |
Record a warning entry.
| category | Subsystem name such as ui or streaming. |
| message | User-visible message text. |
| location | Optional source location for the entry. |