logger class provides console output with color support and formatted printing capabilities for debugging and diagnostics.
Overview
This class extendsgeneric_logger to provide:
- Colored console output with multiple severity levels
- Printf-style formatted printing with type safety
- Output control for suppressing logs
- Cross-platform terminal color support
- Forced printing that bypasses output controls
Constructor & Destructor
Methods
print (string_view)
Prints a message with the specified color.The color to use for the output
The message to print
print (formatted)
Prints a formatted message with the specified color using printf-style formatting.The color to use for the output
Printf-style format string
Arguments matching the format string
force_print
Prints a formatted message that bypasses the output disabled flag.The color to use for the output
Printf-style format string
Arguments matching the format string
Severity-Specific Methods
Convenience methods for common logging levels.info
warn
error
success
log
Output Control
disable_output
true to disable output, false to enableforce_print method bypasses this setting.
is_output_disabled
true if output is currently disabled, false otherwise.
Color Enum
Available colors for terminal output:Usage Example
Platform Notes
- Windows: Automatically manages console code page for UTF-8 support
- Unix/Linux: Uses ANSI escape codes for color output
- Format string safety is enforced via compiler attributes on GCC/Clang
See Also
- windows_emulator - Main emulator class that uses logger
- process_context - Process state management
- syscall_dispatcher - System call handling