{"id":49438760,"url":"https://github.com/saichandesh/express-logging-utility","last_synced_at":"2026-04-29T19:07:13.293Z","repository":{"id":74809806,"uuid":"143643634","full_name":"saichandesh/express-logging-utility","owner":"saichandesh","description":"A node-express middleware which creates a unique transaction id for each request. This unique transaction id can be retrieved anywhere in the request process and can be injected into the logs. Thus helps to identify the logs for each request uniquely. It also helps to create and retrieve variables for each request context individually.","archived":false,"fork":false,"pushed_at":"2018-08-05T22:39:40.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-06T13:40:34.963Z","etag":null,"topics":["express-middleware","expressjs","logging","nestjs","node-logging","nodejs","typescript"],"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/saichandesh.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":"2018-08-05T19:58:44.000Z","updated_at":"2018-08-05T22:39:41.000Z","dependencies_parsed_at":"2023-05-29T09:00:38.867Z","dependency_job_id":null,"html_url":"https://github.com/saichandesh/express-logging-utility","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/saichandesh/express-logging-utility","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saichandesh%2Fexpress-logging-utility","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saichandesh%2Fexpress-logging-utility/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saichandesh%2Fexpress-logging-utility/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saichandesh%2Fexpress-logging-utility/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/saichandesh","download_url":"https://codeload.github.com/saichandesh/express-logging-utility/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saichandesh%2Fexpress-logging-utility/sbom","scorecard":{"id":795475,"data":{"date":"2025-08-11","repo":{"name":"github.com/saichandesh/express-logging-utility","commit":"24b9302556cc1e3bac2eb280e7357e043c3f1c9d"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.8,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/4 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":4,"reason":"6 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-2pr6-76vf-7546","Warn: Project is vulnerable to: GHSA-8j8c-7jfh-h6hx","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-23T08:49:11.494Z","repository_id":74809806,"created_at":"2025-08-23T08:49:11.494Z","updated_at":"2025-08-23T08:49:11.494Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32439401,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T18:12:22.909Z","status":"ssl_error","status_checked_at":"2026-04-29T18:11:33.322Z","response_time":110,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["express-middleware","expressjs","logging","nestjs","node-logging","nodejs","typescript"],"created_at":"2026-04-29T19:07:12.472Z","updated_at":"2026-04-29T19:07:13.284Z","avatar_url":"https://github.com/saichandesh.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Express Logging Utility\n\nExpress logging utility is a light-weight express middleware that provides a unique transaction id for each request. This unique transaction id can be retrieved anywhere in the request process and can be injected into the logs. Thus helps to identify the logs for each request uniquely. This can be used in [Express](https://expressjs.com/),  [Nestjs](https://nestjs.com/) or any other node.js server side frameworks along with logging libraries like [Winston](https://www.npmjs.com/package/winston), [bunyan](https://www.npmjs.com/package/bunyan) etc.,\n\nIt's built on top of [Async Hooks](https://nodejs.org/api/async_hooks.html), a high level api that provides life cycle hooks for asynchronous resources, which can be registered to track asynchronous operations in the node.js request process. This middleware also helps to create and retrieve variables for each request context individually. \n\n## Getting Started\n\n### Prerequisites\nNodejs version \u003e= 8.2.1\n\nUsing npm :\n\n```\nnpm install -g npm\n```\n\n### Installation\n\n```\nnpm install --save express-logging-utility\n```\n\n### Usage\n\n## Express.js\n### To get unique logging id for each request : \n```\nconst express = require('express')\nconst app = express();\n\n// Express logging utility\nconst { middleware, get } = require('express-logging-utility');\n\napp.use(middleware); // Inject express logging utility middleware\n\napp.get('/', (req, res) =\u003e {\n    // Get unique logging transaction id\n    const loggingId = get('loggingId'); \n    console.log(`Request logging id : ${loggingId}`);\n    res.send('Hello World!')\n})\n\napp.listen(3000, () =\u003e console.log('Example app listening on port 3000!'))\n```\n### To share variables across each request : \nIn `index.js`\n```\nconst express = require('express')\nconst app = express();\n\n// Express logging utility\nconst { middleware, set } = require('express-logging-utility');\n\nconst service = require('./service');\n\napp.use(middleware); // Inject express logging utility middleware\n\napp.get('/', (req, res) =\u003e {\n    // Set test variable\n    set('test', 'testing_purpose');\n    res.send(service());\n})\n\napp.listen(3000, () =\u003e console.log('Example app listening on port 3000!'))\n```\nIn `service.js`\n```\n// Express logging utility\nconst { get } = require('express-logging-utility');\n\nmodule.exports = () =\u003e {\n    // Get test variable\n    const test = get('test'); \n    console.log(`test : ${test}`);\n    return 'hello world'\n}\n```\n\n## Nest.js : \n\n### To get unique logging id for each request : \n\nIn `main.ts`\n```\nimport { NestFactory } from '@nestjs/core';\n// Express logging utility\nimport { middleware } from 'express-logging-utility';\n\n// Your application module\nimport { ApplicationModule } from './app.module';\n\nasync function bootstrap() {\n  const app = await NestFactory.create(ApplicationModule);\n  app.use(middleware); // Inject express logging utility middleware\n  await app.listen(3000);\n}\nbootstrap();\n```\nIn `app.controller.ts`\n```\nimport { Controller, Get } from '@nestjs/common';\nimport { get } from 'express-logging-utility'; // import get from express-logging-utility\n\n@Controller('cats')\nexport class CatsController {\n  @Get()\n  findAll() {\n    const loggingId = get('loggingId'); // Get unique logging transaction id\n    console.log(`Request logging id : ${loggingId}`);\n    return 'This action returns all cats';\n  }\n}\n\n```\n### To share variables across each request : \n\nIn `main.ts`\n```\nimport { NestFactory } from '@nestjs/core';\n// Express logging utility\nimport { middleware } from 'express-logging-utility';\n\n// Your application module\nimport { ApplicationModule } from './app.module';\n\nasync function bootstrap() {\n  const app = await NestFactory.create(ApplicationModule);\n  app.use(middleware); // Inject express logging utility middleware\n  await app.listen(3000);\n}\nbootstrap();\n```\nIn `app.controller.ts`\n```\nimport { Controller, Get } from '@nestjs/common';\nimport { set } from 'express-logging-utility'; // import set from express-logging-utility\n\n@Controller('cats')\nexport class CatsController {\n  @Get()\n  findAll() {\n    const loggingId = set('test', 'testing_purpose'); // set variable that will be shared across the request individually.\n    console.log(`Request logging id : ${loggingId}`);\n    return 'This action returns all cats';\n  }\n}\n\n```\nIn `app.service.ts`\n```\nimport { Injectable } from '@nestjs/common';\nimport { Cat } from './interfaces/cat.interface';\nimport { get } from 'express-logging-utility'; // import get from express-logging-utility\n\n@Injectable()\nexport class CatsService {\n  private readonly cats: Cat[] = [];\n\n  findAll(): Cat[] {\n    // Get the variable 'test'\n    const test = get('test'); \n    console.log(`test variable : ${test}`);\n    return this.cats;\n  }\n}\n\n```\n## Authors\n\n* **Sai Chandesh Gurramkonda** - [Github](https://github.com/saichandesh)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaichandesh%2Fexpress-logging-utility","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsaichandesh%2Fexpress-logging-utility","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaichandesh%2Fexpress-logging-utility/lists"}