Console
Provides beautiful console logging for Ruby applications. Implements fast, buffered log output.
Motivation
When Ruby decided to reverse the order of exception backtraces, I finally gave up using the built in logging and decided restore sanity to the output of my programs once and for all!
Features
- Thread safe global logger with per-fiber context.
- Carry along context with nested loggers.
- Enable/disable log levels per-class.
- Detailed logging of exceptions.
- Beautiful logging to the terminal or structured logging using JSON.
Usage
Please browse the source code index or refer to the guides below.
Getting Started
This guide explains how to use console for logging.
Command Line
This guide explains how the console gem can be controlled using environment variables.
Configuration
This guide explains how to implement per-project configuration for the console gem.
Integration
This guide explains how to integrate the console output into different systems.
Events
This guide explains how to log structured events with a well-defined schema.
Releases
Please browse the releases for more details.
v1.34.1
- Add
process_idto serialized output records for clarity (pidis still included for backwards compatibility).- Add
object_idto serialized output records only when the subject is not a string or class/module.
- Add
v1.34.0
- Allow
Console::Compatible::Logger#addto accept**options.
v1.32.0
- Add
fiber_idto serialized output records to help identify which fiber logged the message. - Ractor support appears broken in older Ruby versions, so we now require Ruby 3.4 or later for Ractor compatibility, if you need Ractor support.
v1.31.0
v1.30.0
v1.29.3
- Serialized output now uses
IO#writewith a single string to reduce the chance of interleaved output.
v1.29.2
- Always return
nilfromConsole::Filterlogging methods.
v1.29.1
- Fix logging
exception:keyword argument when the value was not an exception.
v1.29.0
- Don't make
Kernel#warnredirection toConsole.warnthe default behavior, you mustrequire 'console/warn'to enable it. - Remove deprecated
Console::Logger#failure.
v1.28.0
- Add support for
Kernel#warnredirection toConsole.warn.
Contributing
We welcome contributions to this project.
- Fork it.
- Create your feature branch (
git checkout -b my-new-feature). - Commit your changes (
git commit -am 'Add some feature'). - Push to the branch (
git push origin my-new-feature). - Create new Pull Request.
Developer Certificate of Origin
In order to protect users of this project, we require all contributors to comply with the Developer Certificate of Origin. This ensures that all contributions are properly licensed and attributed.
Community Guidelines
This project is best served by a collaborative and respectful environment. Treat each other professionally, respect differing viewpoints, and engage constructively. Harassment, discrimination, or harmful behavior is not tolerated. Communicate clearly, listen actively, and support one another. If any issues arise, please inform the project maintainers.