{"id":31009325,"url":"https://github.com/robhurring/class_logger","last_synced_at":"2025-10-07T15:52:02.120Z","repository":{"id":1352383,"uuid":"1299720","full_name":"robhurring/class_logger","owner":"robhurring","description":"Adds custom logger(s) to any ruby module or class","archived":false,"fork":false,"pushed_at":"2015-06-16T13:57:48.000Z","size":159,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-09-13T04:40:41.677Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/robhurring.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-01-27T17:18:28.000Z","updated_at":"2019-12-24T17:30:53.000Z","dependencies_parsed_at":"2022-07-29T09:09:18.505Z","dependency_job_id":null,"html_url":"https://github.com/robhurring/class_logger","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/robhurring/class_logger","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robhurring%2Fclass_logger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robhurring%2Fclass_logger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robhurring%2Fclass_logger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robhurring%2Fclass_logger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robhurring","download_url":"https://codeload.github.com/robhurring/class_logger/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robhurring%2Fclass_logger/sbom","scorecard":{"id":780591,"data":{"date":"2025-08-11","repo":{"name":"github.com/robhurring/class_logger","commit":"74de22381f5fe4ba8dc5cded148ea566405977f0"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.6,"checks":[{"name":"Code-Review","score":0,"reason":"Found 1/27 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 1 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-23T04:48:47.953Z","repository_id":1352383,"created_at":"2025-08-23T04:48:47.953Z","updated_at":"2025-08-23T04:48:47.953Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278787904,"owners_count":26045860,"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","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2025-09-13T04:34:01.961Z","updated_at":"2025-10-07T15:52:02.115Z","avatar_url":"https://github.com/robhurring.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"Class Logger\n============\n\n[![Build Status](https://travis-ci.org/robhurring/class_logger.png?branch=master)](https://travis-ci.org/robhurring/class_logger)\n\nMakes adding multiple loggers or custom loggers to any ruby class. Written mainly to have certain models in Rails log to a different file while maintaining the original logger (or overwriting it).\n\nThe idea came from [eandrejko](https://github.com/eandrejko) and his class_logger. I just added some more flexibility and made it to work outside of Rails.\n\nInstallation\n------------\n\ngem install class_logger\n\nOptions\n-------\n\nClassLogger supports a bunch of options that are passed straight to the Logger. Most of these options should make sense, but they are described in further detail in Logger's rdoc files.\n\n\u003cdl\u003e\n  \u003cdt\u003e\u003cstrong\u003e:rotate\u003c/strong\u003e\u003c/dt\u003e\n  \u003cdd\u003eSet this to daily, weekly, etc. - anything Logger supports\u003c/dd\u003e\n\n  \u003cdt\u003e\u003cstrong\u003e:max_size\u003c/strong\u003e\u003c/dt\u003e\n  \u003cdd\u003eSet this to the size you want the log to rotate at (or set +rotate+ above)\u003c/dd\u003e\n\n  \u003cdt\u003e\u003cstrong\u003e:keep\u003c/strong\u003e\u003c/dt\u003e\n  \u003cdd\u003eSet this to how many logfiles you want to keep after rotating (or set +rotate+ above)\u003c/dd\u003e\n\n  \u003cdt\u003e\u003cstrong\u003e:path\u003c/strong\u003e\u003c/dt\u003e\n  \u003cdd\u003eThe path to your log folder. (Default: \"%{rails_root}/log\") -- see Interpolations section\u003c/dd\u003e\n\n  \u003cdt\u003e\u003cstrong\u003e:file\u003c/strong\u003e\u003c/dt\u003e\n  \u003cdd\u003eThis is the name of your logfile. (Use: \"%{class_name}\" to interpolate the class's name) (Default: \"%{class_name}.log\") -- see Interpolations section\u003c/dd\u003e\n\n  \u003cdt\u003e\u003cstrong\u003e:in\u003c/strong\u003e\u003c/dt\u003e\n  \u003cdd\u003e\u003cstrong\u003eOverrides :file \u0026amp; :path!\u003c/strong\u003e If you include this setting, it will break the filename from the path and use those options.\u003c/dd\u003e\n\n  \u003cdt\u003e\u003cstrong\u003e:as\u003c/strong\u003e\u003c/dt\u003e\n  \u003cdd\u003eThis is the method your logger will be available to the class as. (Default: logger)\u003c/dd\u003e\n\n  \u003cdt\u003e\u003cstrong\u003e:formatter\u003c/strong\u003e\u003c/dt\u003e\n  \u003cdd\u003eThis can be any custom proc or method you want to assign. (See Logger's rdoc files for more details on this)\u003c/dd\u003e\n\n  \u003cdt\u003e\u003cstrong\u003e:level\u003c/strong\u003e\u003c/dt\u003e\n  \u003cdd\u003eThis is the log level\u003c/dd\u003e\n\u003c/dl\u003e\n\nInterpolations\n--------------\n\nThe following can be used in the *path* or *in* options.\n\n\u003cdl\u003e\n  \u003cdt\u003e\u003cstrong\u003e%{rails_root}\u003c/strong\u003e\u003c/dt\u003e\n  \u003cdd\u003eWill replace itself with Rails.root when in a rails app\u003c/dd\u003e\n\n  \u003cdt\u003e\u003cstrong\u003e%{class_name}\u003c/strong\u003e\u003c/dt\u003e\n  \u003cdd\u003eWill replace itself with the name of the class.\u003c/dd\u003e\n\u003c/dl\u003e\n\nExample Usage\n-------------\n\n```ruby\n  # simple use case to override active records logger\n  class Transaction \u003c ActiveRecord::Base\n    include ClassLogger\n    has_logger\n\n    def process!\n      logger.info \"Creating transation: #{amount}\"  # =\u003e goes to RAILS_ROOT/log/transaction.log\n    end\n  end\n\n\n  # custom logs for special models within rails\n  # specifying a custom logfile and logger name\n  class Transaction \u003c ActiveRecord::Base\n    include ClassLogger\n    has_logger :file =\u003e 'gateway.log', :as =\u003e :gateway_logger\n\n    def process!\n      gateway_logger.info \"Creating transation: #{amount}\"  # =\u003e goes to RAILS_ROOT/log/gateway.log\n      logger.info \"Hello default logger!\"                   # =\u003e goes to default rails logger\n    end\n  end\n\n  # overriding active record's default logger with a custom logfile\n  class Transaction \u003c ActiveRecord::Base\n    include ClassLogger\n    has_logger :file =\u003e 'gateway.log'\n\n    def process!\n      logger.info \"Creating transation: #{amount}\"  # =\u003e goes to RAILS_ROOT/log/gateway.log\n    end\n  end\n\n  # create a logger for a module\n  module Something\n    include ClassLogger\n    has_logger :in =\u003e \"#{File.dirname(__FILE__)}/log/my_module.log\"\n    has_logger :in =\u003e \"/var/log/utoh.log\", :as =\u003e :utoh_logger\n  end\n  Something.logger.info \"Testing 123\" # =\u003e goes to ./log/my_module.log\n  Something.utoh_logger.error \"oops!\" # =\u003e goes to /var/log/utoh.log\n\n  # inside a class with a custom formatter\n  class Something\n    include ClassLogger\n    has_logger :path =\u003e File.expand_path(\"../log\", __FILE__), :rotate =\u003e :daily,\n      :formatter =\u003e proc{ |severity, time, program_name, message| \"[%s](Something): %s\\n\" % [severity, message] }\n\n    def initialize\n      logger.debug \"Created Something.\" # =\u003e goes to ../log/something.log\n    end\n  end\n  Something.new\n  Something.loggers[:logger].debug \"System logger\" # alter entry point to logger\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobhurring%2Fclass_logger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobhurring%2Fclass_logger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobhurring%2Fclass_logger/lists"}