{"id":17988528,"url":"https://github.com/heyvito/logrb","last_synced_at":"2025-03-25T22:33:50.343Z","repository":{"id":56881936,"uuid":"396782415","full_name":"heyvito/logrb","owner":"heyvito","description":"Opinionated logging library for Ruby","archived":false,"fork":false,"pushed_at":"2024-09-17T20:47:59.000Z","size":442,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-20T22:03:51.551Z","etag":null,"topics":["json","logger","logging","ruby","ruby-gem","rubygem","zap"],"latest_commit_sha":null,"homepage":"https://heyvito.github.io/logrb/","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/heyvito.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-08-16T12:21:02.000Z","updated_at":"2024-08-19T19:09:15.000Z","dependencies_parsed_at":"2024-10-29T19:37:25.828Z","dependency_job_id":null,"html_url":"https://github.com/heyvito/logrb","commit_stats":{"total_commits":4,"total_committers":1,"mean_commits":4.0,"dds":0.0,"last_synced_commit":"1b8e8a6347aa893ecc3259e3def6c39dc3f0ab88"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heyvito%2Flogrb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heyvito%2Flogrb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heyvito%2Flogrb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heyvito%2Flogrb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/heyvito","download_url":"https://codeload.github.com/heyvito/logrb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245556284,"owners_count":20634876,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["json","logger","logging","ruby","ruby-gem","rubygem","zap"],"created_at":"2024-10-29T19:11:55.765Z","updated_at":"2025-03-25T22:33:50.046Z","avatar_url":"https://github.com/heyvito.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Logrb\n\n**Logrb** is a small logging library for Ruby, inspired by Go's Zap.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'logrb'\n```\n\nAnd then execute:\n\n    $ bundle install\n\nOr install it yourself as:\n\n    $ gem install logrb\n\n## Usage\n\nStart by creating a new logger:\n\n```ruby\nrequire 'logrb'\n\nlogger = Logrb.new($stdout)\n\n# Additionally, other options can be passed to the initializer:\n# logger = Logrb.new($stdout, [format: :json], [level: :warn], [sample_field: :foo])\n```\n\nThen, call either `error`, `fatal`, `warn`, `info`, `debug`, or `dump`.\n\n```ruby\nlogger.debug(\"Email dispatched\", address: \"foo@bar.com\")\n# =\u003e 2021-08-16T08:42:26.528-0300 DEBUG: \u003cmain\u003e: Email dispatched {:address=\u003e\"foo@bar.com\"}\n\nlogger.info(\"Operation completed\", duration: 3.4)\n# =\u003e 2021-08-16T08:43:00.790-0300 INFO: \u003cmain\u003e: Operation completed {:duration=\u003e3.4}\n\nlogger.warn(\"Attention is required\", event: :something)\n# =\u003e 2021-08-16T08:44:16.172-0300 WARN: \u003cmain\u003e: Attention is required {:event=\u003e:something}\n\nlogger.error(\"Something went wrong\", StandardError.new(\"Boom\"), user_id: 27)\n# =\u003e 2021-08-16T08:47:09.968-0300 ERROR: \u003cmain\u003e: Something went wrong {:user_id=\u003e27}: Boom\n#        (irb):2 in `\u003cmain\u003e'\n#        /usr/local/Cellar/ruby/3.0.2/lib/ruby/3.0.0/irb/workspace.rb:116 in `eval'\n#        /usr/local/Cellar/ruby/3.0.2/lib/ruby/3.0.0/irb/workspace.rb:116 in `evaluate'\n#        /usr/local/Cellar/ruby/3.0.2/lib/ruby/3.0.0/irb/context.rb:450 in `evaluate'\n#        /usr/local/Cellar/ruby/3.0.2/lib/ruby/3.0.0/irb.rb:567 in `block (2 levels) in eval_input'\n#        /usr/local/Cellar/ruby/3.0.2/lib/ruby/3.0.0/irb.rb:751 in `signal_status'\n#        /usr/local/Cellar/ruby/3.0.2/lib/ruby/3.0.0/irb.rb:548 in `block in eval_input'\n#        /usr/local/Cellar/ruby/3.0.2/lib/ruby/3.0.0/irb/ruby-lex.rb:251 in `block (2 levels) in each_top_level_statement'\n#        /usr/local/Cellar/ruby/3.0.2/lib/ruby/3.0.0/irb/ruby-lex.rb:233 in `loop'\n#        /usr/local/Cellar/ruby/3.0.2/lib/ruby/3.0.0/irb/ruby-lex.rb:233 in `block in each_top_level_statement'\n#        /usr/local/Cellar/ruby/3.0.2/lib/ruby/3.0.0/irb/ruby-lex.rb:232 in `catch'\n#        /usr/local/Cellar/ruby/3.0.2/lib/ruby/3.0.0/irb/ruby-lex.rb:232 in `each_top_level_statement'\n#        /usr/local/Cellar/ruby/3.0.2/lib/ruby/3.0.0/irb.rb:547 in `eval_input'\n#        /usr/local/Cellar/ruby/3.0.2/lib/ruby/3.0.0/irb.rb:481 in `block in run'\n#        /usr/local/Cellar/ruby/3.0.2/lib/ruby/3.0.0/irb.rb:480 in `catch'\n#        /usr/local/Cellar/ruby/3.0.2/lib/ruby/3.0.0/irb.rb:480 in `run'\n#        /usr/local/Cellar/ruby/3.0.2/lib/ruby/3.0.0/irb.rb:409 in `start'\n\nlogger.dump(\"Received data\", \"\\xC0\\xFF\\xEE\\xBA\\xBE\")\n# =\u003e 2021-08-16T08:49:52.371-0300 DUMP: \u003cmain\u003e: Received data\n#        00000000  c0 ff ee ba be                                   |.....|\n#        00000005\n#\n```\n\nFor production environments, it is recommended to use a JSON format, which spans\none line per entry:\n\n```ruby\nlogger.debug(\"Email dispatched\", address: \"foo@bar.com\")\n# =\u003e {\"level\":\"debug\",\"caller\":\"(irb):10\",\"msg\":\"Email dispatched\",\"ts\":1629115513,\"address\":\"foo@bar.com\"}\n\nlogger.info(\"Operation completed\", duration: 3.4)\n# =\u003e {\"level\":\"info\",\"caller\":\"(irb):11\",\"msg\":\"Operation completed\",\"ts\":1629115513,\"duration\":3.4}\n\nlogger.warn(\"Attention is required\", event: :something)\n# =\u003e {\"level\":\"warn\",\"caller\":\"(irb):12\",\"msg\":\"Attention is required\",\"ts\":1629115513,\"event\":\"something\"}\n\nlogger.error(\"Something went wrong\", StandardError.new(\"Boom\"), user_id: 27)\n# =\u003e {\"level\":\"error\",\"caller\":\"(irb):13\",\"msg\":\"Something went wrong\",\"ts\":1629115514,\"stacktrace\":\"(irb):13 in `\u003cmain\u003e'\\n/usr/local/Cellar/ruby/3.0.2/lib/ruby/3.0.0/irb/workspace.rb:116 in `eval'\\n/usr/local/Cellar/ruby/3.0.2/lib/ruby/3.0.0/irb/workspace.rb:116 in `evaluate'\\n/usr/local/Cellar/ruby/3.0.2/lib/ruby/3.0.0/irb/context.rb:450 in `evaluate'\\n/usr/local/Cellar/ruby/3.0.2/lib/ruby/3.0.0/irb.rb:567 in `block (2 levels) in eval_input'\\n/usr/local/Cellar/ruby/3.0.2/lib/ruby/3.0.0/irb.rb:751 in `signal_status'\\n/usr/local/Cellar/ruby/3.0.2/lib/ruby/3.0.0/irb.rb:548 in `block in eval_input'\\n/usr/local/Cellar/ruby/3.0.2/lib/ruby/3.0.0/irb/ruby-lex.rb:251 in `block (2 levels) in each_top_level_statement'\\n/usr/local/Cellar/ruby/3.0.2/lib/ruby/3.0.0/irb/ruby-lex.rb:233 in `loop'\\n/usr/local/Cellar/ruby/3.0.2/lib/ruby/3.0.0/irb/ruby-lex.rb:233 in `block in each_top_level_statement'\\n/usr/local/Cellar/ruby/3.0.2/lib/ruby/3.0.0/irb/ruby-lex.rb:232 in `catch'\\n/usr/local/Cellar/ruby/3.0.2/lib/ruby/3.0.0/irb/ruby-lex.rb:232 in `each_top_level_statement'\\n/usr/local/Cellar/ruby/3.0.2/lib/ruby/3.0.0/irb.rb:547 in `eval_input'\\n/usr/local/Cellar/ruby/3.0.2/lib/ruby/3.0.0/irb.rb:481 in `block in run'\\n/usr/local/Cellar/ruby/3.0.2/lib/ruby/3.0.0/irb.rb:480 in `catch'\\n/usr/local/Cellar/ruby/3.0.2/lib/ruby/3.0.0/irb.rb:480 in `run'\\n/usr/local/Cellar/ruby/3.0.2/lib/ruby/3.0.0/irb.rb:409 in `start'\",\"user_id\":27}\n\nlogger.dump(\"Received data\", \"\\xC0\\xFF\\xEE\\xBA\\xBE\")\n# =\u003e {\"level\":\"dump\",\"caller\":\"(irb):14\",\"msg\":\"Received data\",\"ts\":1629115514,\"dump\":\"00000000  c0 ff ee ba be                                   |.....|\\n00000005\"}\n\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/heyvito/logrb. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/heyvito/logrb/blob/master/CODE_OF_CONDUCT.md).\n\n## Code of Conduct\n\nEveryone interacting in the Logrb project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/heyvito/logrb/blob/master/CODE_OF_CONDUCT.md).\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n```\nThe MIT License (MIT)\n\nCopyright (c) 2021 Victor Gama\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheyvito%2Flogrb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fheyvito%2Flogrb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheyvito%2Flogrb/lists"}