{"id":19640067,"url":"https://github.com/bookcreator/gcp-structured-logger","last_synced_at":"2026-05-15T19:33:44.683Z","repository":{"id":37960572,"uuid":"281352472","full_name":"bookcreator/gcp-structured-logger","owner":"bookcreator","description":"Structured logger for GCP logging","archived":false,"fork":false,"pushed_at":"2025-11-26T16:11:29.000Z","size":498,"stargazers_count":1,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-29T11:46:54.637Z","etag":null,"topics":["gcp","logging","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bookcreator.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-07-21T09:21:21.000Z","updated_at":"2025-11-26T16:11:33.000Z","dependencies_parsed_at":"2023-02-01T03:15:31.545Z","dependency_job_id":"eeec2cc1-bccd-43e4-8dd2-8bc53525bf4d","html_url":"https://github.com/bookcreator/gcp-structured-logger","commit_stats":{"total_commits":104,"total_committers":2,"mean_commits":52.0,"dds":"0.21153846153846156","last_synced_commit":"5f326c647826ecc9f526190cd84cfd55f672d1c0"},"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"purl":"pkg:github/bookcreator/gcp-structured-logger","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bookcreator%2Fgcp-structured-logger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bookcreator%2Fgcp-structured-logger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bookcreator%2Fgcp-structured-logger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bookcreator%2Fgcp-structured-logger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bookcreator","download_url":"https://codeload.github.com/bookcreator/gcp-structured-logger/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bookcreator%2Fgcp-structured-logger/sbom","scorecard":{"id":247793,"data":{"date":"2025-08-11","repo":{"name":"github.com/bookcreator/gcp-structured-logger","commit":"007d0908bd556ca44a1a16d2e6ddd4ddf66f9a4d"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/30 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":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","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":"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":"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":"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":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/codeql-analysis.yaml:1","Warn: no topLevel permission defined: .github/workflows/node.js.yaml:1","Info: no jobLevel write permissions found"],"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":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yaml:33: update your workflow using https://app.stepsecurity.io/secureworkflow/bookcreator/gcp-structured-logger/codeql-analysis.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yaml:41: update your workflow using https://app.stepsecurity.io/secureworkflow/bookcreator/gcp-structured-logger/codeql-analysis.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yaml:50: update your workflow using https://app.stepsecurity.io/secureworkflow/bookcreator/gcp-structured-logger/codeql-analysis.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.js.yaml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/bookcreator/gcp-structured-logger/node.js.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.js.yaml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/bookcreator/gcp-structured-logger/node.js.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.js.yaml:40: update your workflow using https://app.stepsecurity.io/secureworkflow/bookcreator/gcp-structured-logger/node.js.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.js.yaml:41: update your workflow using https://app.stepsecurity.io/secureworkflow/bookcreator/gcp-structured-logger/node.js.yaml/master?enable=pin","Info:   0 out of   7 GitHub-owned GitHubAction dependencies pinned"],"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":"SAST","score":10,"reason":"SAST tool detected: CodeQL","details":["Info: SAST configuration detected: CodeQL","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":"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":"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":"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":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.md:0","Info: FSF or OSI recognized license: ISC License: LICENSE.md:0"],"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":3,"reason":"7 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-f82v-jwr5-mffw","Warn: Project is vulnerable to: GHSA-c59h-r6p8-q9wc","Warn: Project is vulnerable to: GHSA-g77x-44xx-532m","Warn: Project is vulnerable to: GHSA-7gfc-8cq8-jh5f","Warn: Project is vulnerable to: GHSA-qpjv-v59x-3qc4","Warn: Project is vulnerable to: GHSA-7fh5-64p2-3v2j"],"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-17T07:55:24.650Z","repository_id":37960572,"created_at":"2025-08-17T07:55:24.650Z","updated_at":"2025-08-17T07:55:24.650Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33076219,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-15T11:35:32.926Z","status":"ssl_error","status_checked_at":"2026-05-15T11:35:31.362Z","response_time":103,"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":["gcp","logging","nodejs"],"created_at":"2024-11-11T14:04:33.055Z","updated_at":"2026-05-15T19:33:44.668Z","avatar_url":"https://github.com/bookcreator.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GCP Structured Logger \n[![Node.js CI](https://github.com/bookcreator/gcp-structured-logger/workflows/Node.js%20CI/badge.svg)](https://github.com/bookcreator/gcp-structured-logger/actions?query=workflow%3A%22Node.js+CI%22)\n[![npm version](https://img.shields.io/npm/v/gcp-structured-logger.svg)](https://www.npmjs.org/package/gcp-structured-logger)\n\nOutputs [structured logs](https://cloud.google.com/run/docs/logging#writing_structured_logs) that are formatted in GCP logging.\n\n\n## Basic Usage\n\nMost basic usage it to create a `Logging` object and use the `logger` property.\n\n```js\nconst { Logging, LogSeverity } = require('gcp-structured-logger')\n\nconst logging = new Logging({\n   projectId: '\u003cproject-id\u003e',\n   logName: '\u003clabel for logName\u003e', // Useful for filtering in Log viewer\n   serviceContext: {\n      service: '\u003cservice name\u003e', // Name that appears in Error Reporter\n      version: '\u003cversion\u003e', // Optional version\n   },\n   extraLabels: { // Optional extra labels useful for more filtering\n   },\n   requestUserExtractor: () =\u003e {} // See below\n})\n\nlogging.logger.info('Some log message', {\n   extra: 'data'\n}, ['Array'])\n```\n\n\n## Error reporting\n\nTo report errors to GCP Error Reporting the `reportError` method on a logger can be used.\nAn optional `severity` can also be passed in, or it is picked up from the provided error. If no `severity` is passed in `ERROR` is used.\n\n```js\nconst err = new Error('An error occurred')\n\nlogging.logger.reportError(err)\n\n// With severity\nlogging.logger.reportError(err, LogSeverity.ALERT)\n```\n\n\n## Monitoring Node Process\n\nThese get logged out to GCP Error reporting.\n\n```js\n// Listen out for uncaughtException (uses uncaughtExceptionMonitor in v12.17+) and unhandled Promise rejections\nlogging.attachToProcess(logging.logger)\n\n// To remove from the process\nconst detachLogger = logging.attachToProcess(logging.logger)\ndetachLogger()\n```\n\n\n## With Express\n\nCan be use with [`express`](http://expressjs.com) as a logging middleware and error handler.\n\nIf the `err` has a `statusCode` or `status` property that is greater or equal to 500, then the severity of the err is set to `WARNING`.\n\n```js\nconst express = require('express')\n\nconst app = express()\n\n// App setup - set port, trust proxy, etc\n\n// Add ability to use req.log in later middleware\napp.use(logger.makeLoggingMiddleware())\n\napp.use((req, res, next) =\u003e {\n   req.log.debug('Incoming request')\n   next()\n})\n\n// Add routes\n// And a final error handler if needed\napp.use((req, res, next) =\u003e next({ status: 404, message: 'Not found' }))\n\n// Report next(err)\napp.use(logger.makeErrorMiddleware())\n```\n\n\n## With NextJS\n\nCan be use Next.js in the [middleware file](https://nextjs.org/docs/app/building-your-application/routing/middleware#convention), it should be added as the first middleware (to allow you to use `req.log` in future middlewares).\nThis then adds the `.log` property onto all requests.\n\n```ts\nimport { NextResponse } from 'next/server'\nimport type { NextRequest } from 'next/server'\n \nexport function middleware(request: NextRequest) {\n   logger.nextJSMiddleware(request);\n\n   // Continue or do usual middleware handling\n   return NextResponse.next();\n}\n```\n\nYou can also pass in a `requestUserExtractor` function when creating a `Logging` instance for setting the [user](https://cloud.google.com/error-reporting/reference/rest/v1beta1/ErrorContext#FIELDS.user) of the error.\n\nThis is useful if you've attached the logged in user, etc. to the request or the headers contains some user info.\n\nIf `requestUserExtractor` returns no value (or is not provided), no user will be set on the reported error.\n\n```js\nconst logging = new Logging({\n   projectId: '\u003cproject-id\u003e',\n   logName: '\u003clabel for logName\u003e',\n   serviceContext: {\n      service: '\u003cservice name\u003e',\n   },\n   requestUserExtractor: req =\u003e {\n      // Parameter is the request that log.reportError was called on\n      return req.get('user-id')\n   },\n})\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbookcreator%2Fgcp-structured-logger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbookcreator%2Fgcp-structured-logger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbookcreator%2Fgcp-structured-logger/lists"}