{"id":20727233,"url":"https://github.com/hmcts/nodejs-logging","last_synced_at":"2025-04-23T18:51:38.343Z","repository":{"id":22155509,"uuid":"94910163","full_name":"hmcts/nodejs-logging","owner":"hmcts","description":"Common logging components for Reform's Node.js projects","archived":false,"fork":false,"pushed_at":"2023-08-24T20:48:10.000Z","size":440,"stargazers_count":0,"open_issues_count":6,"forks_count":4,"subscribers_count":191,"default_branch":"master","last_synced_at":"2024-04-14T11:10:52.405Z","etag":null,"topics":["javascript","logging","travis-ci","yarn"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/hmcts.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE.md","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":"2017-06-20T16:02:32.000Z","updated_at":"2024-06-19T03:51:03.228Z","dependencies_parsed_at":"2024-06-19T04:10:57.051Z","dependency_job_id":null,"html_url":"https://github.com/hmcts/nodejs-logging","commit_stats":{"total_commits":81,"total_committers":16,"mean_commits":5.0625,"dds":0.7407407407407407,"last_synced_commit":"37beac8f2001e3cd5cc33ae6e8cd4d09baa1477b"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hmcts%2Fnodejs-logging","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hmcts%2Fnodejs-logging/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hmcts%2Fnodejs-logging/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hmcts%2Fnodejs-logging/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hmcts","download_url":"https://codeload.github.com/hmcts/nodejs-logging/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224850185,"owners_count":17380128,"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":["javascript","logging","travis-ci","yarn"],"created_at":"2024-11-17T04:29:39.305Z","updated_at":"2024-11-17T04:29:40.026Z","avatar_url":"https://github.com/hmcts.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Node.js Logging\n\n[![Greenkeeper badge](https://badges.greenkeeper.io/hmcts/nodejs-logging.svg)](https://greenkeeper.io/)\n\nA logging component used by Reform's Node.js applications.\n\n**This is not compatible with Reform tactical logging spec. Logger 2.x should be used for tactical applications.**\n\nSome background info:\n* there are 6 log levels: `silly` (5), `debug` (4), `verbose` (3), `info` (2), `warn` (1) and `error` (0).\n* log level can be set via an environment variable `LOG_LEVEL`, the default is `info`.\n* logging output in JSON format can be enabled by setting environment variable `JSON_PRINT` to `true`, the default is `false`:\n* by default logging is turned off when running the unit tests.\n\n## Usage\n\nAdd it as your project's dependency:\n\n```bash\nyarn add @hmcts/nodejs-logging\n```\n\nRequire it:\n\n```javascript\nconst { Logger } = require('@hmcts/nodejs-logging')\n```\n\nThen you can create a logger instance and use it to log information:\n\n```javascript\nconst logger = Logger.getLogger('app.js') // app.js is just an example, can be anything that's meaningful to you\n```\n\nUsage are:\n\n```\nlogger.info({\n  message: 'Yay, logging!'\n})\n```\n\nor\n\n```\nlogger.log({\n  level: 'info',\n  message: 'What time is the testing at?'\n});\n```\n\nAbove will result in the following log printed (if JSON format is enabled).\n\n```\n{ level: 'info',\n  message: 'What time is the testing at?',\n  label: 'app.js',\n  timestamp: '2017-09-30T03:57:26.875Z' }\n```\n\n### Access logging for Express applications \n\nOptionally you can use the built-in Express access logger:\n\n```javascript\nconst { Express } = require('@hmcts/nodejs-logging')\n\napp.use(Express.accessLogger())\n```\n\n## Units Tests\n\nJust do\n\n```\nyarn test\n```\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE.md) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhmcts%2Fnodejs-logging","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhmcts%2Fnodejs-logging","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhmcts%2Fnodejs-logging/lists"}