{"id":22168740,"url":"https://github.com/mccann-hub/json-logger","last_synced_at":"2026-02-13T21:31:39.305Z","repository":{"id":261408152,"uuid":"882097090","full_name":"McCann-Hub/json-logger","owner":"McCann-Hub","description":"A secure, configurable JSON logger built on Winston for Node.js and Deno applications. Supports custom log levels, structured JSON output, sensitive data sanitization, and error handling for multi-environment setups.","archived":false,"fork":false,"pushed_at":"2024-11-26T23:47:02.000Z","size":136,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-27T00:27:36.984Z","etag":null,"topics":["deno","deno-module","typescript","typescript-library","winston","winston-logger"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/McCann-Hub.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-01T22:03:18.000Z","updated_at":"2024-11-26T23:47:06.000Z","dependencies_parsed_at":"2024-11-27T00:35:05.632Z","dependency_job_id":null,"html_url":"https://github.com/McCann-Hub/json-logger","commit_stats":null,"previous_names":["mccann-hub/json-logger"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/McCann-Hub%2Fjson-logger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/McCann-Hub%2Fjson-logger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/McCann-Hub%2Fjson-logger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/McCann-Hub%2Fjson-logger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/McCann-Hub","download_url":"https://codeload.github.com/McCann-Hub/json-logger/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227681941,"owners_count":17803573,"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":["deno","deno-module","typescript","typescript-library","winston","winston-logger"],"created_at":"2024-12-02T06:25:05.381Z","updated_at":"2026-02-13T21:31:39.234Z","avatar_url":"https://github.com/McCann-Hub.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# json-logger\n\nA configurable, secure logging module built on Winston for Node.js applications. This logger formats logs as JSON objects, supports custom log levels, sanitizes sensitive data, colorizes output, and provides structured JSON formatting. Ideal for multi-environment setups with security-focused logging.\n\n## Features\n\n* **Customizable log output levels based on NODE_ENV** to control which log levels are recorded in different environments\n* **Colorized console output** for enhanced readability\n* **JSON formatting** for structured logs, with pretty-print options\n* **Sensitive data sanitization** to prevent plain-text logging of sensitive fields\n* **Uncaught Exception \u0026 Rejection Handling** for robust error logging\n\n## Installation\n\n```bash\nnpm install @mccann-hub/json-logger\n```\n\n## Usage\n\n### Basic Setup\n\nInitialize the logger with default settings:\n\n```javascript\nimport Logger from '@mccann-hub/json-logger';\n\nconst logger = Logger();\n\n// Logging examples\nlogger.info('Informational message');\nlogger.error('An error occurred', { error: new Error('Sample error') });\n```\n\n### Configuration Options\n\n### Application Name\n\nThe logger will attempt to retrieve the application name in the following order of precedence:\n\n1) From package.json (if it exists), using the name field.\n2) From deno.json (if it exists), using the name field.\n3) From the LOGGER_APP_NAME environment variable.\n\nExample for setting LOGGER_APP_NAME:\n\n```bash\nexport LOGGER_APP_NAME=\"MyAppName\"\n```\n\n#### Log Output Levels\n\nThe logger adjusts output levels based on NODE_ENV:\n\n* **local / development:** Logs all levels (debug and higher).\n* **local-test:** Logs only error level by default.\n* **production:** Logs info, http, warn, and error levels only.\n\nThe default level can also be overridden by setting `WINSTON_LEVEL`:\n\n```bash\nexport WINSTON_LEVEL=debug\n```\n\n#### Sensitive Data Sanitization\n\nSanitize sensitive fields by specifying keys to redact:\n\n```javascript\nconst logger = Logger(undefined, ['SECRET', 'PASSWORD', 'TOKEN']);\nlogger.info('User login', { password: 'secret123', token: 'abc' });\n```\n\nFields like `user_password` and `api_token` will appear as `***REDACTED***` in the logs.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmccann-hub%2Fjson-logger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmccann-hub%2Fjson-logger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmccann-hub%2Fjson-logger/lists"}