Sha256: 45b71acaca50a65ef5c872c392e89365cd1720707cf04df01d5ae546e82e9ce9
Contents?: true
Size: 1.05 KB
Versions: 1
Compression:
Stored size: 1.05 KB
Contents
# Better Log Formatter A formatter allowing you to add dynamic tags to your logs with sidekiq tags support ## Usage ```ruby logger = Logger.new(STDOUT) formatter = BetterLogFormatter.new("my_app") formatter.custom_tag(:foo) { 'Bar' } formatter.custom_tag(:request_id) { Request.id } logger.formatter = formatter logger.info "Hello world!" # 2018-09-16T12:42:27.843291 my_app[1337][Bar][a776fea1-e24c-4976-b8c4-df790b1aefcb] -- INFO: Hello world! ``` Also, timestamp can be hidden or removed: ```ruby formatter.datetime_format = "%m/%d/%y - %H:%M:%S " logger.info "Hello world!" # 09/16/2018T12:42:27 my_app[1337][Bar][a776fea1-e24c-4976-b8c4-df790b1aefcb] -- INFO: Hello world! formatter.datetime_display = false logger.info "Hello world!" # my_app[1337][Bar][a776fea1-e24c-4976-b8c4-df790b1aefcb] -- INFO: Hello world! ``` ## Contributing Bug reports and pull requests are welcome on GitHub at https://github.com/spuyet/better_log_formatter. ## License The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
better_log_formatter-0.1.0 | README.md |