{"id":23542373,"url":"https://github.com/neo9/n9-node-log","last_synced_at":"2025-06-29T08:38:11.899Z","repository":{"id":24504539,"uuid":"101781363","full_name":"neo9/n9-node-log","owner":"neo9","description":"Logging node module for json or classic logging with levels.","archived":false,"fork":false,"pushed_at":"2023-11-14T17:28:59.000Z","size":852,"stargazers_count":5,"open_issues_count":3,"forks_count":4,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-21T01:10:31.054Z","etag":null,"topics":["log","logger","logging","nodejs"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/neo9.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":"2017-08-29T16:12:41.000Z","updated_at":"2024-02-04T18:33:35.000Z","dependencies_parsed_at":"2024-06-18T22:38:09.550Z","dependency_job_id":"79b6aeb6-7a19-452e-9fb2-a310c1726b76","html_url":"https://github.com/neo9/n9-node-log","commit_stats":{"total_commits":118,"total_committers":9,"mean_commits":13.11111111111111,"dds":0.5677966101694916,"last_synced_commit":"18bc379796f5e936f24b9e1c146a84f35db17bc4"},"previous_names":[],"tags_count":43,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neo9%2Fn9-node-log","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neo9%2Fn9-node-log/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neo9%2Fn9-node-log/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neo9%2Fn9-node-log/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neo9","download_url":"https://codeload.github.com/neo9/n9-node-log/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250522298,"owners_count":21444511,"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":["log","logger","logging","nodejs"],"created_at":"2024-12-26T06:11:47.009Z","updated_at":"2025-04-23T22:02:12.597Z","avatar_url":"https://github.com/neo9.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# n9-node-log\n\nLogging node module based on Pino.\n\n[![npm version](https://img.shields.io/npm/v/@neo9/n9-node-log.svg)](https://www.npmjs.com/package/@neo9/n9-node-log)\n[![Travis](https://img.shields.io/travis/neo9/n9-node-log/master.svg)](https://travis-ci.org/neo9/n9-node-log)\n[![Coverage](https://img.shields.io/codecov/c/github/neo9/n9-node-log/master.svg)](https://codecov.io/gh/neo9/n9-node-log)\n[![license](https://img.shields.io/github/license/neo9/n9-node-log.svg)](https://github.com/neo9/n9-node-log/blob/master/LICENSE)\n\n## Requirements\n\n- NodeJS \u003e= 10.0.0\n\n## Installation\n\n```bash\nnpm install --save @neo9/n9-node-log\n```\n\n## Usage\n\n```ts\nimport n9Log from '@neo9/n9-node-log';\n\nconst log = n9Log('my-app-name');\n\n// Write on stdout\nlog.trace('This is a trace message');\nlog.debug('This is a debug message');\nlog.info('This is an information message');\nlog.warn('Warning, this feature will be removed soon');\n// Write on stderr\nlog.error('An error appened');\n```\n\n```console\n2017-05-12T15:57:14.474Z - info: [my-app-name] This is an information message\n2017-05-12T15:57:14.689Z - warn: [my-app-name] Warning, this feature will be removed soon\n2017-05-12T15:57:14.974Z - error: [my-app-name] An error appened\n```\n\n## Metadata\n\n```ts\nlog.info('Log with metadata', { anything: 'this is metadata' });\nlog.error('Here an error', new Error('hello'));\n```\n\n```console\n2017-05-12T15:57:14.474Z - info: [my-app-name] Log with metadata anything=this is metadata\n2017-05-12T15:57:14.785Z - error: [node-ts-skeleton] Here an error Error: hello\n     err: {\n      \"type\": \"Error\",\n      \"message\": \"something-went-wrong\",\n      \"stack\":\n          Error: something-went-wrong\n              at /home/bdaniel/projects/neo9/n9-libs/n9-node-log/test/index.ts:110:29\n    }\n```\n\n## Prefixing\n\n```ts\nconst logUsers = log.module('users');\n\nlogUsers.info('Log specific to users module');\n```\n\n```console\n2017-05-12T15:57:14.474Z - info: [my-app-name:users] Log specific to users module\n```\n\n## Profiling\n\n```ts\nlog.profile('test');\nsetTimeout(() =\u003e log.profile('test'), 1000);\n```\n\n```console\n2017-05-12T15:57:14.474Z - info: [my-app-name] test {\"durationMs\":1000}\n```\n\n## Log level\n\nYou can filter the list of logs on startup with the `N9LOG` environment or with the `level` option.\n\nPossible values:\n\n- `trace`: Display all logs\n- `debug`: Display debug + info + warn + error logs\n- `info`: Display info + warn + error logs\n- `warn`: Display warn + error logs\n- `error`: Display only error logs\n\nDefault value: `info`\n\nExample: `N9LOG=error node server.js` will display only error logs.\n\nFor performance matter, you can check if you need to compute your log data :\n\n```js\nif (log.isLevelEnabled('debug')) {\n\tlog.debug('My debug log', { complexDataAsOneField: JSON.stringify(data) });\n}\n```\n\n# Breaking changes from V3 to V4\n\n- Log level verbose renamed to log level trace\n- JSON Format is enabled by default, it wasn't before\n- Remove transports features\n- Filters function change their signatures\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneo9%2Fn9-node-log","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneo9%2Fn9-node-log","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneo9%2Fn9-node-log/lists"}