![]() |
Moonlight-XboxOG latest
Moonlight Xbox OG is a port of the Moonlight Game Streaming client to the original Xbox console.
|
Declares logging configuration and output. More...
#include <cstddef>#include <cstdint>#include <deque>#include <functional>#include <mutex>#include <string>#include <string_view>#include <vector>Go to the source code of this file.
Classes | |
| struct | logging::detail::GlobalLoggingState |
| Process-wide mutable logger state shared by the logging helpers. More... | |
| struct | logging::LogEntry |
| Structured log entry stored by the in-memory logger. More... | |
| class | logging::Logger |
| Small in-memory logger with a ring buffer and optional sinks. More... | |
| struct | logging::LogSourceLocation |
| Optional source location captured for a structured log entry. More... | |
| struct | logging::LogTimestamp |
| Local wall-clock timestamp captured for each retained log entry. More... | |
Typedefs | |
| using | logging::LogSink = std::function<void(const LogEntry &entry)> |
| Callback invoked for each accepted log entry. | |
| using | logging::TimestampProvider = std::function<LogTimestamp()> |
| Callback that supplies timestamps for new log entries. | |
Enumerations | |
| enum class | logging::LogLevel { trace = 0 , debug = 1 , info = 2 , warning = 3 , error = 4 , none = 5 } |
| Severity levels used by the Moonlight client logger. More... | |
Functions | |
| bool | logging::debug (std::string category, std::string message, LogSourceLocation location=LogSourceLocation::current()) |
| Record a debug entry through the registered global logger. | |
| bool | logging::error (std::string category, std::string message, LogSourceLocation location=LogSourceLocation::current()) |
| Record an error entry through the registered global logger. | |
| std::string | logging::format_entry (const LogEntry &entry) |
| Format a log entry for text consoles or overlays. | |
| std::string | logging::format_source_location (const LogSourceLocation &location) |
| Format a source location for text consoles or overlays. | |
| std::string | logging::format_startup_console_line (LogLevel level, std::string_view category, std::string_view message) |
| Format one startup console line without timestamps or source locations. | |
| std::string | logging::format_timestamp (const LogTimestamp ×tamp) |
| Format a local wall-clock timestamp for log prefixes. | |
| bool | logging::has_global_logger () |
| Return whether a global logger is currently available. | |
| bool | logging::info (std::string category, std::string message, LogSourceLocation location=LogSourceLocation::current()) |
| Record an info entry through the registered global logger. | |
| bool | logging::log (LogLevel level, std::string category, std::string message, LogSourceLocation location=LogSourceLocation::current()) |
| Record a structured entry through the registered global logger. | |
| void | logging::print_startup_console_line (LogLevel level, std::string_view category, std::string_view message) |
| Print one startup console line when output is enabled. | |
| void | logging::set_debugger_console_minimum_level (LogLevel minimumLevel) |
| Update the debugger-console minimum level on the registered global logger. | |
| void | logging::set_file_minimum_level (LogLevel minimumLevel) |
| Update the runtime file sink minimum level on the registered global logger. | |
| void | logging::set_file_sink (LogSink sink) |
| Install or replace the runtime file sink on the registered global logger. | |
| void | logging::set_global_logger (Logger *logger) |
| Register the process-wide logger used by convenience logging helpers. | |
| void | logging::set_minimum_level (LogLevel minimumLevel) |
| Update the retained in-memory minimum level on the registered global logger. | |
| void | logging::set_startup_console_enabled (bool enabled) |
| Enable or disable startup console output. | |
| void | logging::set_startup_debug_enabled (bool enabled) |
| Enable or disable startup debug mirroring on the registered global logger. | |
| std::vector< LogEntry > | logging::snapshot (LogLevel minimumLevel=LogLevel::trace) |
| Return a filtered snapshot from the registered global logger. | |
| bool | logging::startup_console_enabled () |
| Return whether startup console output is currently enabled. | |
| const char * | logging::to_string (LogLevel level) |
| Return the display label for a log level. | |
| bool | logging::trace (std::string category, std::string message, LogSourceLocation location=LogSourceLocation::current()) |
| Record a trace entry through the registered global logger. | |
| bool | logging::warn (std::string category, std::string message, LogSourceLocation location=LogSourceLocation::current()) |
| Record a warning entry through the registered global logger. | |
Declares logging configuration and output.
|
strong |
Severity levels used by the Moonlight client logger.
| bool logging::debug | ( | std::string | category, |
| std::string | message, | ||
| LogSourceLocation | location = LogSourceLocation::current() ) |
Record a debug entry through the registered global logger.
| category | Subsystem name such as ui or streaming. |
| message | User-visible message text. |
| location | Source location for the entry. |
| bool logging::error | ( | std::string | category, |
| std::string | message, | ||
| LogSourceLocation | location = LogSourceLocation::current() ) |
Record an error entry through the registered global logger.
| category | Subsystem name such as ui or streaming. |
| message | User-visible message text. |
| location | Source location for the entry. |
| std::string logging::format_entry | ( | const LogEntry & | entry | ) |
Format a log entry for text consoles or overlays.
| entry | The entry to format. |
| std::string logging::format_source_location | ( | const LogSourceLocation & | location | ) |
Format a source location for text consoles or overlays.
| location | Source location to format. |
|
nodiscard |
Format one startup console line without timestamps or source locations.
| level | Structured log level to display. |
| category | Short subsystem category such as startup or sdl. |
| message | Human-readable console text. |
| std::string logging::format_timestamp | ( | const LogTimestamp & | timestamp | ) |
Format a local wall-clock timestamp for log prefixes.
| timestamp | Local timestamp to format. |
|
nodiscard |
Return whether a global logger is currently available.
| bool logging::info | ( | std::string | category, |
| std::string | message, | ||
| LogSourceLocation | location = LogSourceLocation::current() ) |
Record an info entry through the registered global logger.
| category | Subsystem name such as ui or streaming. |
| message | User-visible message text. |
| location | Source location for the entry. |
| bool logging::log | ( | LogLevel | level, |
| std::string | category, | ||
| std::string | message, | ||
| LogSourceLocation | location = LogSourceLocation::current() ) |
Record a structured entry through the registered global logger.
| level | Severity for the entry. |
| category | Subsystem name such as ui or streaming. |
| message | User-visible message text. |
| location | Source location for the entry. |
| void logging::print_startup_console_line | ( | LogLevel | level, |
| std::string_view | category, | ||
| std::string_view | message ) |
Print one startup console line when output is enabled.
| level | Structured log level to display. |
| category | Short subsystem category such as startup or sdl. |
| message | Human-readable console text. |
| void logging::set_debugger_console_minimum_level | ( | LogLevel | minimumLevel | ) |
Update the debugger-console minimum level on the registered global logger.
| minimumLevel | Entries below this level are not mirrored to DbgPrint(). |
| void logging::set_file_minimum_level | ( | LogLevel | minimumLevel | ) |
Update the runtime file sink minimum level on the registered global logger.
| minimumLevel | Entries below this level are not mirrored to the file sink. |
| void logging::set_file_sink | ( | LogSink | sink | ) |
Install or replace the runtime file sink on the registered global logger.
| sink | Callback invoked for entries accepted by the file minimum level. |
| void logging::set_global_logger | ( | Logger * | logger | ) |
Register the process-wide logger used by convenience logging helpers.
| logger | Logger instance to expose globally, or nullptr to clear it. |
| void logging::set_minimum_level | ( | LogLevel | minimumLevel | ) |
Update the retained in-memory minimum level on the registered global logger.
| minimumLevel | Entries below this level are not kept in memory. |
| void logging::set_startup_console_enabled | ( | bool | enabled | ) |
Enable or disable startup console output.
| enabled | True to allow future startup console writes. |
| void logging::set_startup_debug_enabled | ( | bool | enabled | ) |
Enable or disable startup debug mirroring on the registered global logger.
| enabled | True to mirror future entries to the pre-splash startup console. |
|
nodiscard |
Return a filtered snapshot from the registered global logger.
| minimumLevel | Minimum level to include in the returned snapshot. |
|
nodiscard |
Return whether startup console output is currently enabled.
| const char * logging::to_string | ( | LogLevel | level | ) |
Return the display label for a log level.
| level | The level to stringify. |
| bool logging::trace | ( | std::string | category, |
| std::string | message, | ||
| LogSourceLocation | location = LogSourceLocation::current() ) |
Record a trace entry through the registered global logger.
| category | Subsystem name such as ui or streaming. |
| message | User-visible message text. |
| location | Source location for the entry. |
| bool logging::warn | ( | std::string | category, |
| std::string | message, | ||
| LogSourceLocation | location = LogSourceLocation::current() ) |
Record a warning entry through the registered global logger.
| category | Subsystem name such as ui or streaming. |
| message | User-visible message text. |
| location | Source location for the entry. |