{"id":13463280,"url":"https://github.com/TwP/logging","last_synced_at":"2025-03-25T06:31:47.233Z","repository":{"id":402283,"uuid":"20669","full_name":"TwP/logging","owner":"TwP","description":"A flexible logging library for use in Ruby programs based on the design of Java's log4j library.","archived":false,"fork":false,"pushed_at":"2024-07-14T06:57:25.000Z","size":1001,"stargazers_count":530,"open_issues_count":13,"forks_count":98,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-10T03:15:41.450Z","etag":null,"topics":["logging"],"latest_commit_sha":null,"homepage":"https://rubygems.org/gems/logging","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/TwP.png","metadata":{"files":{"readme":"README.md","changelog":"History.txt","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"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":"2008-05-30T04:03:30.000Z","updated_at":"2025-03-05T12:19:26.000Z","dependencies_parsed_at":"2024-06-18T11:11:52.032Z","dependency_job_id":"4f3a9e0e-9ab9-45ac-b2cd-c7aa0bfc88d1","html_url":"https://github.com/TwP/logging","commit_stats":{"total_commits":636,"total_committers":43,"mean_commits":"14.790697674418604","dds":"0.15251572327044027","last_synced_commit":"63d4b9e796aa74988e443ce15729a3c9c3466c45"},"previous_names":[],"tags_count":45,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TwP%2Flogging","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TwP%2Flogging/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TwP%2Flogging/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TwP%2Flogging/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TwP","download_url":"https://codeload.github.com/TwP/logging/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242804166,"owners_count":20187879,"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":["logging"],"created_at":"2024-07-31T13:00:49.692Z","updated_at":"2025-03-25T06:31:47.200Z","avatar_url":"https://github.com/TwP.png","language":"Ruby","readme":"[![.github/workflows/ruby.yml](https://github.com/TwP/logging/actions/workflows/ruby.yml/badge.svg)](https://github.com/TwP/logging/actions/workflows/ruby.yml)\n\n## Logging\nby Tim Pease\n\n* [Homepage](http://rubygems.org/gems/logging)\n* [Github Project](https://github.com/TwP/logging)\n\n### Description\n\n**Logging** is a flexible logging library for use in Ruby programs based on the\ndesign of Java's log4j library. It features a hierarchical logging system,\ncustom level names, multiple output destinations per log event, custom\nformatting, and more.\n\n### Installation\n\n```\ngem install logging\n```\n\n### Examples\n\nThis example configures a logger to output messages in a format similar to the\ncore ruby Logger class. Only log messages that are warnings or higher will be\nlogged.\n\n```ruby\nrequire 'logging'\n\nlogger = Logging.logger(STDOUT)\nlogger.level = :warn\n\nlogger.debug \"this debug message will not be output by the logger\"\nlogger.warn \"this is your last warning\"\n```\n\nIn this example, a single logger is created that will append to STDOUT and to a\nfile. Only log messages that are informational or higher will be logged.\n\n```ruby\nrequire 'logging'\n\nlogger = Logging.logger['example_logger']\nlogger.level = :info\n\nlogger.add_appenders \\\n    Logging.appenders.stdout,\n    Logging.appenders.file('example.log')\n\nlogger.debug \"this debug message will not be output by the logger\"\nlogger.info \"just some friendly advice\"\n```\n\nThe Logging library was created to allow each class in a program to have its\nown configurable logger. The logging level for a particular class can be\nchanged independently of all other loggers in the system. This example shows\nthe recommended way of accomplishing this.\n\n```ruby\nrequire 'logging'\n\nLogging.logger['FirstClass'].level = :warn\nLogging.logger['SecondClass'].level = :debug\n\nclass FirstClass\n  def initialize\n    @logger = Logging.logger[self]\n  end\n\n  def some_method\n    @logger.debug \"some method was called on #{self.inspect}\"\n  end\nend\n\nclass SecondClass\n  def initialize\n    @logger = Logging.logger[self]\n  end\n\n  def another_method\n    @logger.debug \"another method was called on #{self.inspect}\"\n  end\nend\n```\n\nThere are many more examples in the [examples folder](/examples) of the logging\npackage. The recommended reading order is the following:\n\n* [simple.rb](/examples/simple.rb)\n* [rspec_integration.rb](/examples/rspec_integration.rb)\n* [loggers.rb](/examples/loggers.rb)\n* [classes.rb](/examples/classes.rb)\n* [hierarchies.rb](/examples/hierarchies.rb)\n* [names.rb](/examples/names.rb)\n* [lazy.rb](/examples/lazy.rb)\n* [appenders.rb](/examples/appenders.rb)\n* [layouts.rb](/examples/layouts.rb)\n* [reusing_layouts.rb](/examples/reusing_layouts.rb)\n* [formatting.rb](/examples/formatting.rb)\n* [colorization.rb](/examples/colorization.rb)\n* [fork.rb](/examples/fork.rb)\n* [mdc.rb](/examples/mdc.rb)\n\n### Extending\n\nThe Logging framework is extensible via the [little-plugger](https://github.com/twp/little-plugger)\ngem-based plugin system. New appenders, layouts, or filters can be released as ruby\ngems. When installed locally, the Logging framework will automatically detect\nthese gems as plugins and make them available for use.\n\nThe [logging-email](https://github.com/twp/logging-email) plugin is a good\nexample to follow. It includes a [`lib/logging/plugins/email.rb`](https://github.com/twp/logging-email/tree/master/lib/logging/plugins/email.rb)\nfile which is detected by the plugin framework. This file declares a\n`Logging::Plugins::Email.initialize_email` method that is called when the plugin\nis loaded.\n\nThe three steps for creating a plugin are:\n\n* create a new Ruby gem: `logging-\u003cname\u003e`\n* include a plugin file: `lib/logging/plugins/\u003cname\u003e.rb`\n* define a plugin initializer: `Logging::Plugins::\u003cName\u003e.initialize_\u003cname\u003e`\n\n### Development\n\nThe Logging source code relies on the Mr Bones project for default rake tasks.\nYou will need to install the Mr Bones gem if you want to build or test the\nlogging gem. Conveniently there is a bootstrap script that you can run to setup\nyour development environment.\n\n```\nscript/bootstrap\n```\n\nThis will install the Mr Bones gem and the required Ruby gems for development.\nAfter this is done you can rake `rake -T` to see the available rake tasks.\n\n### License\n\nThe MIT License - see the [LICENSE](/LICENSE) file for the full text.\n","funding_links":[],"categories":["Maintenance \u0026 Monitoring","Ruby","Logging"],"sub_categories":["Logging"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTwP%2Flogging","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FTwP%2Flogging","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTwP%2Flogging/lists"}