Logit::Backend::Console
Inherits Logit::BufferedIO / Logit::Backend / Reference / Object
Backend that writes log events to the console (STDOUT).
Uses the Formatter::Human formatter by default, which produces colorized,
human-readable output suitable for development and debugging.
Basic Usage
Logit.configure do |config|
config.console(level: Logit::LogLevel::Debug)
end
Custom Configuration
# Use JSON formatter for console output
Logit.configure do |config|
config.console(
level: Logit::LogLevel::Info,
formatter: Logit::Formatter::JSON.new
)
end
Output Example (Human formatter)
10:30:45.123 INFO UserService#find_user (2ms) → User{id: 42} user_service.cr:15
args: id=42
Constructors
new(name = "console", level = LogLevel::Info, formatter = Formatter::Human.new)
Creates a new console backend.
- name: Backend name for identification (default: "console")
- level: Minimum log level (default: Info)
- formatter: Output formatter (default: Human)