{"id":23440898,"url":"https://github.com/tedconf/json_logger","last_synced_at":"2025-04-09T20:37:40.776Z","repository":{"id":10317783,"uuid":"12444996","full_name":"tedconf/json_logger","owner":"tedconf","description":"Simple structured logging.","archived":false,"fork":false,"pushed_at":"2023-06-13T16:31:20.000Z","size":31,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":26,"default_branch":"master","last_synced_at":"2025-02-15T12:47:54.743Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/tedconf.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2013-08-28T21:25:13.000Z","updated_at":"2023-09-26T19:56:55.000Z","dependencies_parsed_at":"2025-02-15T12:44:53.658Z","dependency_job_id":"7fa7af52-b2b7-4757-9cd5-516c0c9756b5","html_url":"https://github.com/tedconf/json_logger","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tedconf%2Fjson_logger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tedconf%2Fjson_logger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tedconf%2Fjson_logger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tedconf%2Fjson_logger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tedconf","download_url":"https://codeload.github.com/tedconf/json_logger/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248108897,"owners_count":21049220,"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-12-23T16:20:24.483Z","updated_at":"2025-04-09T20:37:40.753Z","avatar_url":"https://github.com/tedconf.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"## JSON Logger\n\nSimple structured logging.\n\nA subclass of Ruby's standard `Logger` which makes it easy to write structured\ndata to your log files.\n\n## Basic Usage\n\n```ruby\ninstance = JsonLogger.factory(\n  :device =\u003e '/tmp/test.log', # anything understood by Logger.new\n  :level =\u003e Logger::INFO,\n  :progname =\u003e 'foo'\n)\ninstance.info('a simple message')\ninstance.error(:key =\u003e 'value', :other =\u003e [1,2,3])\n```\n\nOutput in `/tmp/test.log`:\n```json\n{\n  \"time\":\"2013-08-28T20:54:42.048Z\",\n  \"progname\":\"foo\",\n  \"level\":\"INFO\",\n  \"level_id\":1,\n  \"msg\":\"a simple message\"\n}\n{\n  \"time\":\"2013-08-28T20:52:48.321Z\",\n  \"progname\":\"foo\",\n  \"level\":\"ERROR\",\n  \"level_id\":3,\n  \"data\":\"data\",\n  \"other\":[1,2,3]\n}\n```\n\nMessages are actually written 1 per line (separated by a newline). I added the\nextra newlines here for readability.\n\n## Factory Defaults\n\nYou can set some defaults which will be added to every `factory` call. This\nworks well from a Rails initializer, for example.\n\nSubsequent calls to `factory` will always include these defaults, though they\ncan be overridden if desired.\n\n```ruby\nJsonLogger.factory_defaults = {\n  :device =\u003e '/tmp/test.log',\n  :level =\u003e Logger::INFO\n}\ninstance = JsonLogger.factory(:progname =\u003e 'foo')\ninstance.info 'a simple message'\n```\n\n## Presets\n\nA `factory` call can include preset values which will be added to any log\nmessages created by the returned instance.\n\n```ruby\ninstance = JsonLogger.factory(:progname =\u003e 'foo', :presets =\u003e {:a =\u003e 'b', :c =\u003e 'd'})\ninstance.error('hello')\n```\n\nOutput:\n```json\n{\n  \"time\":\"2013-08-28T20:52:48.321Z\",\n  \"progname\":\"foo\",\n  \"level\":\"ERROR\",\n  \"level_id\":3,\n  \"a\":\"b\",\n  \"c\":\"d\",\n  \"msg\":\"hello\",\n}\n```\n\n## Development\n\n### CI\nThis application uses [Github Actions](https://github.com/tedconf/json_logger/actions) for CI.\n\n## Copyright\n\nCopyright (c) 2013 Alex Dean. See LICENSE.txt for\nfurther details.\n\n\nTag for hackweek glossary:\n\n\u003c!--- project_def --\u003e\nSimple structured logging. A subclass of Ruby's standard Logger which makes it easy to write structured data to your log files.\n\nVertical: Tools\n\nRelated links: https://github.com/tedconf/json_logger\n\u003c!--- /project_def --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftedconf%2Fjson_logger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftedconf%2Fjson_logger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftedconf%2Fjson_logger/lists"}