{"id":22275682,"url":"https://github.com/igrek8/gc-json-logger-express","last_synced_at":"2026-05-13T07:04:12.302Z","repository":{"id":60809731,"uuid":"544810640","full_name":"igrek8/gc-json-logger-express","owner":"igrek8","description":"Structured logging for express.js app in GKE","archived":false,"fork":false,"pushed_at":"2024-05-08T19:22:42.000Z","size":1704,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-01T09:39:15.310Z","etag":null,"topics":["express-js","google-cloud","logger","logging"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/igrek8.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-03T09:11:04.000Z","updated_at":"2023-07-07T21:35:34.000Z","dependencies_parsed_at":"2023-10-14T19:13:41.463Z","dependency_job_id":"dc1d25ed-8217-4cdb-9f11-8c6ade29011d","html_url":"https://github.com/igrek8/gc-json-logger-express","commit_stats":{"total_commits":280,"total_committers":3,"mean_commits":93.33333333333333,"dds":0.08571428571428574,"last_synced_commit":"a2f9580b0bc5d93f6d7f8d1e7e4831b71e59a59a"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igrek8%2Fgc-json-logger-express","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igrek8%2Fgc-json-logger-express/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igrek8%2Fgc-json-logger-express/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igrek8%2Fgc-json-logger-express/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/igrek8","download_url":"https://codeload.github.com/igrek8/gc-json-logger-express/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245509146,"owners_count":20626921,"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":["express-js","google-cloud","logger","logging"],"created_at":"2024-12-03T14:11:32.734Z","updated_at":"2026-05-13T07:04:12.257Z","avatar_url":"https://github.com/igrek8.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Logger for [Structured Logging](https://cloud.google.com/logging/docs/structured-logging) with [Asynchronous Context Tracking](https://nodejs.org/api/async_context.html#class-asynclocalstorage) (Stability: 2 - Stable) to log HTTP traffic in Express.JS in GKE\n\n[![NPM](https://badgen.net/npm/v/gc-json-logger-express)](https://www.npmjs.com/gc-json-logger-express)\n[![Coverage](https://codecov.io/gh/igrek8/gc-json-logger-express/branch/main/graph/badge.svg)](https://codecov.io/gh/igrek8/gc-json-logger-express)\n![Health](https://badgen.net/github/checks/igrek8/gc-json-logger-express)\n![License](https://badgen.net/github/license/igrek8/gc-json-logger-express)\n[![Runkit](https://badgen.net/badge/runkit/playground/cyan)](https://npm.runkit.com/gc-json-logger-express)\n\n## Installation\n\n```bash\nnpm install --save gc-json-logger gc-json-logger-express\n\nyarn add gc-json-logger gc-json-logger-express\n```\n\n## View in Google Cloud Logging\n\n![Google Cloud Logging](./media/google-cloud-logging.png)\n\n## Integration\n\n```js\nconst { Logger, Severity } = require('gc-json-logger');\nconst { log } = require('gc-json-logger-express');\nconst express = require('express');\n\nconst app = express();\n\n/* Set desired application log level */\nLogger.setLevel(Severity.DEBUG);\n\n/* Filter sensitive data or transform log entry */\napp.use(\n  log((_req, _res, entry) =\u003e {\n    const severity = entry.meta.httpRequest?.status \u003e= 500 ? Severity.ERROR : entry.severity;\n    return { ...entry, severity };\n  })\n);\n\napp.use(express.text());\napp.use(express.json());\napp.use((req, res) =\u003e res.status(500).send(req.body));\n\napp.listen(3000);\n```\n\n### Mock Request\n\n```bash\ncurl -X POST \"http://localhost:3000/echo\" \\\n  -H \"Content-Type: text/plain\" \\\n  -d 'Hello world!'\n```\n\n### Logged Request\n\n```json\n{\n  \"severity\": \"INFO\",\n  \"timestamp\": \"2022-01-01T00:00:00.000Z\",\n  \"message\": \"200 POST /echo\",\n  \"httpRequest\": {\n    \"protocol\": \"HTTP/1.1\",\n    \"requestSize\": \"141\",\n    \"remoteIp\": \"::ffff:127.0.0.1\",\n    \"requestUrl\": \"http://localhost:3000/echo\",\n    \"requestMethod\": \"POST\",\n    \"userAgent\": \"curl/7.79.1\",\n    \"serverIp\": \"::ffff:127.0.0.1:3000\"\n  },\n  \"logging.googleapis.com/operation\": {\n    \"id\": \"Application\"\n  }\n}\n```\n\n### Logged Request and Response\n\n```json\n{\n  \"severity\": \"ERROR\",\n  \"timestamp\": \"2022-01-01T00:00:00.000Z\",\n  \"message\": \"500 POST /echo (13ms)\",\n  \"httpRequest\": {\n    \"latency\": \"13ms\",\n    \"responseSize\": \"258\",\n    \"status\": 500\n  },\n  \"logging.googleapis.com/operation\": {\n    \"id\": \"Application\"\n  },\n  \"meta\": {\n    \"request\": {\n      \"headers\": {\n        \"host\": \"localhost:3000\",\n        \"user-agent\": \"curl/7.79.1\",\n        \"accept\": \"*/*\",\n        \"content-type\": \"text/plain\",\n        \"content-length\": \"12\"\n      },\n      \"body\": \"Hello world!\"\n    },\n    \"response\": {\n      \"headers\": {\n        \"x-powered-by\": \"Express\",\n        \"content-type\": \"text/html; charset=utf-8\",\n        \"content-length\": \"12\",\n        \"etag\": \"W/\\\"c-00hq6RNueFa8QiEjhep5cJRHWAI\\\"\"\n      },\n      \"body\": \"Hello world!\"\n    }\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Figrek8%2Fgc-json-logger-express","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Figrek8%2Fgc-json-logger-express","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Figrek8%2Fgc-json-logger-express/lists"}