log-json_formatter v2.0.1
log-json_formatter
A Log::Formatter
for JSON-encoded logs to an IO
Installation
-
Add the dependency to your
shard.yml
:dependencies: log-json_formatter: github: dscottboggs/log-json_formatter
-
Run
shards install
Usage
require "log-json_formatter"
record CustomType, a = 1, b = 2 do
include ::Log::JSONFormatter::Loggable
def_to_metadata_value({a: @a, b: @b})
end
::Log.setup level: :trace,
backend: Log::IOBackend.new formatter: Log::JSONFormatter,
Log.info &.emit "example message", metadata: 1, values: %w[of any kind],
"even values of a": CustomType.new
Contributing
- Fork it (https://github.com/dscottboggs/log-json_formatter/fork)
- 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 a new Pull Request
Contributors
- D. Scott Boggs - creator and maintainer
Repository
log-json_formatter
Owner
Statistic
- 0
- 0
- 0
- 0
- 0
- about 2 years ago
- August 28, 2022
License
Mozilla Public License 2.0
Links
Synced at
Sat, 21 Dec 2024 15:09:29 GMT
Languages