{"id":13484221,"url":"https://github.com/rudionrails/yell","last_synced_at":"2025-03-27T16:30:33.931Z","repository":{"id":279797736,"uuid":"939630623","full_name":"rudionrails/yell","owner":"rudionrails","description":"Yell - Your Extensible Logging Library","archived":true,"fork":true,"pushed_at":"2025-02-26T21:13:48.000Z","size":446,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-07T14:39:18.512Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"rsmdt/yell","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rudionrails.png","metadata":{},"created_at":"2025-02-26T21:09:54.000Z","updated_at":"2025-02-26T21:14:00.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/rudionrails/yell","commit_stats":null,"previous_names":["rudionrails/yell"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rudionrails%2Fyell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rudionrails%2Fyell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rudionrails%2Fyell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rudionrails%2Fyell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rudionrails","download_url":"https://codeload.github.com/rudionrails/yell/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245882189,"owners_count":20687844,"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":[],"created_at":"2024-07-31T17:01:20.892Z","updated_at":"2025-03-27T16:30:33.896Z","avatar_url":"https://github.com/rudionrails.png","language":"Ruby","funding_links":[],"categories":["Ruby","Gems","Logging"],"sub_categories":["Logging"],"readme":"# Yell [![Gem Version](https://badge.fury.io/rb/yell.svg)](http://badge.fury.io/rb/yell) [![Build Status](https://travis-ci.org/rudionrails/yell.svg?branch=master)](https://travis-ci.org/rudionrails/yell) [![Code Climate](https://codeclimate.com/github/rudionrails/yell.svg)](https://codeclimate.com/github/rudionrails/yell) [![Coverage Status](https://coveralls.io/repos/rudionrails/yell/badge.svg?branch=master)](https://coveralls.io/r/rudionrails/yell)\n\n\n**Yell - Your Extensible Logging Library** is a comprehensive logging replacement for Ruby.\n\nYell works and its test suite currently runs on:\n\n- ruby-head, 2.3.1, 2.2.5, 2.2.2, 2.1.0, 2.0.0 \n- jruby-head, jruby-9.1.0.0, jruby-9.0.0.0\n\nIf you want to conveniently use Yell with Rails, then head over to [yell-rails](https://github.com/rudionrails/yell-rails). You'll find all the documentation in this repository, though.\n\n\n## Installation\n\nSystem wide:\n\n```console\ngem install yell\n```\n\nOr in your Gemfile:\n\n```ruby\ngem \"yell\"\n```\n\n\n## Usage\n\nOn the basics, you can use Yell just like any other logging library with a more \nsophisticated message formatter.\n\n```ruby\nlogger = Yell.new STDOUT\n\nlogger.info \"Hello World\"\n#=\u003e \"2012-02-29T09:30:00+01:00 [ INFO] 65784 : Hello World\"\n#    ^                         ^       ^       ^\n#    ISO8601 Timestamp         Level   Pid     Message\n```\n\nThe strength of Yell, however, comes when using multiple adapters. The already built-in \nones are IO-based and require no further configuration. Also, there are additional ones \navailable as separate gems. Please consult the [wiki](https://github.com/rudionrails/yell/wiki) \non that - they are listed there.\n\nThe standard adapters are:\n\n`:stdout` : Messages will be written to STDOUT  \n`:stderr` : Messages will be written to STDERR  \n`:file` : Messages will be written to a file  \n`:datefile` : Messages will be written to a timestamped file  \n\n\nHere are some short examples on how to combine them:\n\n##### Example: Notice messages go into `STDOUT` and error messages into `STDERR`\n\n```ruby\nlogger = Yell.new do |l|\n  l.adapter STDOUT, level: [:debug, :info, :warn]\n  l.adapter STDERR, level: [:error, :fatal]\nend\n```\n\n##### Example: Typical production Logger\n\nWe setup a logger that starts passing messages at the `:info` level. Severities \nbelow `:error` go into the 'production.log', whereas anything higher is written \ninto the 'error.log'.\n\n```ruby\nlogger = Yell.new do |l|\n  l.level = 'gte.info' # will only pass :info and above to the adapters\n\n  l.adapter :datefile, 'production.log', level: 'lte.warn' # anything lower or equal to :warn\n  l.adapter :datefile, 'error.log', level: 'gte.error' # anything greater or equal to :error\nend\n```\n\n##### Example: Typical production Logger for Heroku\n\nWhen deploying to Heroku, the \"rails_log_stdout\" gem gets injected to your Rails project.\nYell does not need that when properly configured (see [yell-rails](https://github.com/rudionrails/yell-rails)\nfor a more convenient integration with Rails).\n\n```ruby\nlogger = Yell.new do |l|\n  l.level = 'gte.info'\n\n  l.adapter :stdout, level: 'lte.warn'\n  l.adapter :stderr, level: 'gte.error'\nend\n```\n\n### But I'm used to Log4r and I don't want to move on\n\nOne of the really nice features of Log4r is its repository. The following example is \ntaken from the official Log4r [documentation](http://log4r.rubyforge.org/manual.html#outofbox).\n\n```ruby\nrequire 'log4r'\ninclude Log4r\n\n# create a logger named 'mylog' that logs to stdout\nmylog = Logger.new 'mylog'\nmylog.outputters = Outputter.stdout\n\n# later in the code, you can get the logger back\nLogger['mylog']\n```\n\nWith Yell you can do the same thing with less:\n\n```ruby\nrequire 'yell'\n\n# create a logger named 'mylog' that logs to stdout\nYell.new :stdout, name: 'mylog'\n\n# later in the code, you can get the logger back\nYell['mylog']\n```\n\nThere is no need to define outputters separately and you don't have to taint \nyou global namespace with Yell's subclasses.\n\n### Adding a logger to an existing class\n\nYell comes with a simple module: +Yell::Loggable+. Simply include this in a class and \nyou are good to go.\n\n```ruby\n# Before you can use it, you will need to define a logger and \n# provide it with the `:name` of your class.\nYell.new :stdout, name: 'Foo'\n\nclass Foo\n  include Yell::Loggable\nend\n\n# Now you can log\nFoo.logger.info \"Hello World\"\nFoo.new.logger.info \"Hello World\"\n```\n\nIt even works with class inheritance:\n\n```ruby\n# Given the above example, we inherit from Foo\nclass Bar \u003c Foo\nend\n\n# The logger will fallback to the Foo superclass\nBar.logger.info \"Hello World\"\nBar.new.logger.info \"Hello World\"\n```\n\n### Adding a logger to all classes at once (global logger)\n\nDerived from the example above, simply do the following.\n\n```ruby\n# Define a logger and pass `Object` as name. Internally, Yell adds this\n# logger to the repository where you can access it later on.\nYell.new :stdout, name: Object\n\n# Enable logging for the class that (almost) every Ruby class inherits from\nObject.send :include, Yell::Loggable\n\n# now you are good to go... from wherever you are\nlogger.info \"Hello from anything\"\nInteger.logger.info \"Hello from Integer\"\n```\n\n### Suppress log messages with silencers\n\nIn case you woul like to suppress certain log messages, you may define\nsilencers with Yell. Use this to get control of a noisy log environment. For\ninstance, you can suppress logging messages that contain secure information or\nmore simply, to skip information about serving your Rails assets. Provide a\nstring or a regular expression of the message patterns you would like to exclude.\n\n```ruby\nlogger = Yell.new do |l|\n  l.silence /^Started GET \"\\/assets/\n  l.silence /^Served asset/\nend\n\nlogger.debug 'Started GET \"/assets/logo.png\" for 127.0.0.1 at 2013-06-20 10:18:38 +0200'\nlogger.debug 'Served asset /logo.png - 304 Not Modified (0ms)'\n```\n\n### Alter log messages with modifiers\n\n\n## Further Readings\n\n[How To: Setting The Log Level](https://github.com/rudionrails/yell/wiki/101-setting-the-log-level)  \n[How To: Formatting Log Messages](https://github.com/rudionrails/yell/wiki/101-formatting-log-messages)  \n[How To: Using Adapters](https://github.com/rudionrails/yell/wiki/101-using-adapters)  \n[How To: The Datefile Adapter](https://github.com/rudionrails/yell/wiki/101-the-datefile-adapter)  \n[How To: Different Adapters for Different Log Levels](https://github.com/rudionrails/yell/wiki/101-different-adapters-for-different-log-levels)  \n\n\n### Additional Adapters\n[Syslog](https://github.com/rudionrails/yell/wiki/additional-adapters-syslog)  \n[syslog-sd](https://github.com/raymond-wells/yell-adapters-syslogsd)  \n[Graylog2 (GELF)](https://github.com/rudionrails/yell/wiki/additional-adapters-gelf)  \n[Fluentd](https://github.com/red5studios/yell-adapters-fluentd)  \n\n\n### Development\n\n[How To: Writing Your Own Adapter](https://github.com/rudionrails/yell/wiki/Writing-your-own-adapter)  \n\nYou can find further examples and additional adapters in the [wiki](https://github.com/rudionrails/yell/wiki).\nor have a look into the examples folder.\n\n\nCopyright \u0026copy; 2011-current Rudolf Schmidt, released under the MIT license\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frudionrails%2Fyell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frudionrails%2Fyell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frudionrails%2Fyell/lists"}