{"id":19360513,"url":"https://github.com/uber5/nodejs-logging","last_synced_at":"2026-05-16T15:37:51.330Z","repository":{"id":34655677,"uuid":"156887657","full_name":"Uber5/nodejs-logging","owner":"Uber5","description":"Opinionated attempt to simplify logging by choosing sane defaults for dev and prod","archived":false,"fork":false,"pushed_at":"2023-01-04T17:32:22.000Z","size":1059,"stargazers_count":1,"open_issues_count":15,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-24T22:01:16.173Z","etag":null,"topics":["logging","nodejs","winston"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/Uber5.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":"2018-11-09T16:19:44.000Z","updated_at":"2020-09-02T05:44:08.000Z","dependencies_parsed_at":"2023-01-15T08:23:31.216Z","dependency_job_id":null,"html_url":"https://github.com/Uber5/nodejs-logging","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/Uber5%2Fnodejs-logging","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Uber5%2Fnodejs-logging/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Uber5%2Fnodejs-logging/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Uber5%2Fnodejs-logging/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Uber5","download_url":"https://codeload.github.com/Uber5/nodejs-logging/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240475239,"owners_count":19807292,"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":["logging","nodejs","winston"],"created_at":"2024-11-10T07:18:26.527Z","updated_at":"2026-05-16T15:37:51.298Z","avatar_url":"https://github.com/Uber5.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Opinionated Logging for NodeJS\n\nSetting up logging that is useful and flexible, for both development and production, seems hard.\n\nThis is an opinionated approach, with sane defaults, for servers (HTTP or otherwise) written in NodeJS.\n\n# Principles and Settings\n\n- Use `console.log` as you wish in development, but (by default) suppress its output in production (`NODE_ENV === 'production'`).\n- In order to see `console.log` output in production, set `WINSTON_LEVEL` to `debug` (which will also enable all [winston](https://www.npmjs.com/package/winston) based `logger.debug()` logs).\n- log output in production is into `./app-%date%.log`, no output on the console itself.\n- Log output, when not in production, is to the console, nothing written to files.\n- In production, an additional file `error-%date%.log` is written with actual errors.\n- Files written are limited in size and rotated.\n- Files older than 14 days are removed.\n\n# Install\n\nVia npm\n\n```\nnpm install --save u5-nodejs-logging\n```\n\n... or via yarn\n\n```\nyarn add u5-nodejs-logging\n```\n\n# Logging via Winston\n\n```\nconst { logger } = require('u5-nodejs-logging')\n\n...\nlogger.info('successfully saved')\n...\n```\n\n# Request Logging and Error Handling for ExpressJS\n\n```\nconst {\n  expressLoggingMiddleware, expressErrorHandlingMiddleware\n} = require('u5-nodejs-logging')\n\nconst app = express()\n\napp.use(expressLoggingMiddleware()) // first middleware\n// ... routes etc here, via app.get() etc.\napp.use(expressErrorHandlingMiddleware()) // last middleware\napp.listen(process.env.PORT || 3000)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuber5%2Fnodejs-logging","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuber5%2Fnodejs-logging","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuber5%2Fnodejs-logging/lists"}