{"_id":"5w-logger","_rev":"5-5ad1d785f6c56f7fcf9bc16f946c40b5","name":"5w-logger","dist-tags":{"latest":"1.0.4"},"versions":{"1.0.0":{"name":"5w-logger","version":"1.0.0","author":{"name":"Juhani Hakosalo"},"license":"MIT","_id":"5w-logger@1.0.0","maintainers":[{"name":"heikkohoo","email":"juhani.hakosalo@gmail.com"}],"homepage":"https://github.com/Heikkohoo/5w-logger#readme","bugs":{"url":"https://github.com/Heikkohoo/5w-logger/issues"},"dist":{"shasum":"8fef44ee43d8831cab60dfa7d22bdaa97a8d9b94","tarball":"https://registry.npmjs.org/5w-logger/-/5w-logger-1.0.0.tgz","fileCount":21,"integrity":"sha512-ZNjQ0UPne8gyP6PyhBGC+JBqGyURbxzDvQL7eYyijaq3boXbM86147v1eXeoH/Q7EXbONx/7JwHT+vsMFHBgCQ==","signatures":[{"sig":"MEUCIAIdTyKcOULUVEm6SEyRM1jgqbWllvpwJy1HAut7GWALAiEAz5w/Y0e7KeI59WE1Qi6vLXMdzQw38gZogdoGX1Gegqk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":52943},"main":"dist/5w-logger.js","gitHead":"f098db770a77f3375fd78c6516b8ac907ea917c7","scripts":{"lint":"eslint \"src/**/*.ts\"","test":"mocha --require ts-node/register src/*.spec.ts src/**/*.spec.ts","build":"npm run lint && tsc"},"typings":"dist/5w-logger.d.ts","_npmUser":{"name":"heikkohoo","email":"juhani.hakosalo@gmail.com"},"repository":{"url":"git+https://github.com/Heikkohoo/5w-logger.git","type":"git"},"_npmVersion":"11.9.0","description":"5w logger library","directories":{},"_nodeVersion":"24.14.0","dependencies":{"uuid":"13.0.0"},"_hasShrinkwrap":false,"devDependencies":{"chai":"6.2.2","mocha":"11.7.5","globals":"^17.4.0","ts-node":"10.9.2","@eslint/js":"^10.0.1","typescript":"5.9.3","@types/chai":"5.2.3","@types/node":"25.5.0","@types/mocha":"10.0.10","typescript-eslint":"^8.57.2","eslint-plugin-functional":"^9.0.4"},"_npmOperationalInternal":{"tmp":"tmp/5w-logger_1.0.0_1774860716157_0.043095561753255573","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"5w-logger","version":"1.0.1","author":{"name":"Juhani Hakosalo"},"license":"MIT","_id":"5w-logger@1.0.1","maintainers":[{"name":"heikkohoo","email":"juhani.hakosalo@gmail.com"}],"homepage":"https://github.com/Heikkohoo/5w-logger#readme","bugs":{"url":"https://github.com/Heikkohoo/5w-logger/issues"},"dist":{"shasum":"ff012ecb6b9a8dc7ca93ef9f1ab261a8dc4369b5","tarball":"https://registry.npmjs.org/5w-logger/-/5w-logger-1.0.1.tgz","fileCount":21,"integrity":"sha512-5nhc6wzeH5tdoAmI3qFxhQT8caBhlevl+JF0s/PbrZckTatLbyfri6ZvOB3hApXWmGdCsszLJ9g2ODHPcB4xNA==","signatures":[{"sig":"MEQCIGaTYy93PgMEgMlMYyMBi795C+S9hqx15J561HCC7kahAiAivTIh9PL/0XJhBKPAwtLuusFuHDvS2YfAK0jOHzQ5oQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":55906},"main":"dist/5w-logger.js","gitHead":"11bf2ddc2839916300e79fb9e5d6197ea0a4c29c","scripts":{"lint":"eslint \"src/**/*.ts\"","test":"mocha --require ts-node/register src/*.spec.ts src/**/*.spec.ts","build":"npm run lint && tsc"},"typings":"dist/5w-logger.d.ts","_npmUser":{"name":"heikkohoo","email":"juhani.hakosalo@gmail.com"},"repository":{"url":"git+https://github.com/Heikkohoo/5w-logger.git","type":"git"},"_npmVersion":"11.9.0","description":"5w logger library","directories":{},"_nodeVersion":"24.14.0","dependencies":{"uuid":"14.0.0"},"_hasShrinkwrap":false,"devDependencies":{"chai":"6.2.2","mocha":"11.7.5","globals":"^17.4.0","ts-node":"10.9.2","@eslint/js":"^10.0.1","typescript":"6.0.3","@types/chai":"5.2.3","@types/node":"25.5.0","@types/mocha":"10.0.10","typescript-eslint":"^8.59.2","eslint-plugin-functional":"^9.0.4","@typescript-eslint/parser":"^8.59.2","@typescript-eslint/eslint-plugin":"^8.59.2"},"_npmOperationalInternal":{"tmp":"tmp/5w-logger_1.0.1_1778158633772_0.7193240663432994","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"5w-logger","version":"1.0.2","author":{"name":"Juhani Hakosalo"},"license":"MIT","_id":"5w-logger@1.0.2","maintainers":[{"name":"heikkohoo","email":"juhani.hakosalo@gmail.com"}],"homepage":"https://github.com/Heikkohoo/5w-logger#readme","bugs":{"url":"https://github.com/Heikkohoo/5w-logger/issues"},"dist":{"shasum":"051e1a2f2dd254fa2d7f5f1901ef889e13ad129c","tarball":"https://registry.npmjs.org/5w-logger/-/5w-logger-1.0.2.tgz","fileCount":21,"integrity":"sha512-rjqyf3xBb0I7HIUbObU2Q49HOVwI7mexjsLcdJUckLtA+xvQnZqTNRf+UjNWllHk5cbAxhik32IM9Pkh3vqpQQ==","signatures":[{"sig":"MEYCIQDzBQJ0/vupg3xNUethaCGBMIXdWS5vEblUso0I9I+KLAIhANKzSeH2ASNN2pBj9GhWwCv9QzogiLaJqd+6FJKDE13h","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":55907},"main":"dist/5w-logger.js","gitHead":"954c8cb72da0a33f335f3db678ddebcd7a255bf6","scripts":{"lint":"eslint \"src/**/*.ts\"","test":"mocha --require ts-node/register src/*.spec.ts src/**/*.spec.ts","build":"npm run lint && tsc"},"typings":"dist/5w-logger.d.ts","_npmUser":{"name":"heikkohoo","email":"juhani.hakosalo@gmail.com"},"repository":{"url":"git+https://github.com/Heikkohoo/5w-logger.git","type":"git"},"_npmVersion":"11.9.0","description":"5w logger library","directories":{},"_nodeVersion":"24.14.0","dependencies":{"uuid":"14.0.0"},"_hasShrinkwrap":false,"devDependencies":{"chai":"6.2.2","mocha":"11.7.6","globals":"^17.4.0","ts-node":"10.9.2","@eslint/js":"^10.0.1","typescript":"6.0.3","@types/chai":"5.2.3","@types/node":"25.9.1","@types/mocha":"10.0.10","typescript-eslint":"^8.59.2","eslint-plugin-functional":"^10.0.0","@typescript-eslint/parser":"^8.59.2","@typescript-eslint/eslint-plugin":"^8.59.2"},"_npmOperationalInternal":{"tmp":"tmp/5w-logger_1.0.2_1780655864016_0.14372298103825853","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"5w-logger","version":"1.0.3","author":{"name":"Juhani Hakosalo"},"license":"MIT","_id":"5w-logger@1.0.3","maintainers":[{"name":"heikkohoo","email":"juhani.hakosalo@gmail.com"}],"homepage":"https://github.com/Heikkohoo/5w-logger#readme","bugs":{"url":"https://github.com/Heikkohoo/5w-logger/issues"},"dist":{"shasum":"5173185f7ba39bef9fab7125480290e77e4c43bc","tarball":"https://registry.npmjs.org/5w-logger/-/5w-logger-1.0.3.tgz","fileCount":21,"integrity":"sha512-ifcpXERMk6JlhrtF0mgNFAlv2GaPu5H4PzWSXkleQ39wXOd3eNE42aQ/jBcKyxyPcvvsT3oPIkd0HFf4cZMw+A==","signatures":[{"sig":"MEQCIEYDPLMYHaKKBeng5uM+M2JQ4W3sKUoyAshP323SqaVYAiA6+O4B72VjFvdHQK56Gm0lNS/W2FmcqA2PU27UihoL9w==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":56282},"main":"dist/5w-logger.js","gitHead":"c08d154b48f51537420b42a1bdbcac4998d7e37a","scripts":{"lint":"eslint \"src/**/*.ts\"","test":"mocha --require ts-node/register src/*.spec.ts src/**/*.spec.ts","build":"npm run lint && tsc"},"typings":"dist/5w-logger.d.ts","_npmUser":{"name":"heikkohoo","email":"juhani.hakosalo@gmail.com"},"overrides":{"mocha":{"diff":"8.0.4","serialize-javascript":"7.0.7"},"deepmerge-ts":"8.0.2"},"repository":{"url":"git+https://github.com/Heikkohoo/5w-logger.git","type":"git"},"_npmVersion":"11.9.0","description":"5w logger library","directories":{},"_nodeVersion":"24.14.0","dependencies":{"uuid":"14.0.0"},"_hasShrinkwrap":false,"devDependencies":{"chai":"6.2.2","mocha":"11.8.0","globals":"^17.11.0","ts-node":"10.9.2","@eslint/js":"^10.0.1","typescript":"6.0.3","@types/chai":"5.2.3","@types/node":"26.4.0","@types/mocha":"10.0.10","typescript-eslint":"^8.68.0","eslint-plugin-functional":"^10.0.0","@typescript-eslint/parser":"^8.68.0","@typescript-eslint/eslint-plugin":"^8.68.0"},"x-overrides-note":"Keep these overrides while Mocha 11.x is in use; remove after upgrading to Mocha 12 stable or newer.","_npmOperationalInternal":{"tmp":"tmp/5w-logger_1.0.3_1787821194479_0.5848990437940831","host":"s3://npm-registry-packages-npm-production"},"x-deepmerge-ts-override-note":"Use patched deepmerge-ts 8.0.2 to avoid downgrading eslint-plugin-functional."},"1.0.4":{"_id":"5w-logger@1.0.4","bugs":{"url":"https://github.com/Heikkohoo/5w-logger/issues"},"dist":{"shasum":"4c52166bf87a0bcbb060a37e7dce232dc436d885","tarball":"https://registry.npmjs.org/5w-logger/-/5w-logger-1.0.4.tgz","fileCount":21,"integrity":"sha512-vSC/uhLfty+8fqjWBLhBtrcBAxWWNBwylZYvgPhMX5X98CUgWiC4bOFDKGWymF7ybqXDZSUmgLPeoyksa+mVIw==","signatures":[{"sig":"MEUCIQDQozrOcUXYDGaaswt/wxyWvp/ySSE4uGLbHcolLtqxLgIgM2I/YYNWehlGlyxlqOeNLw49KpW0yRVMyQcYEsCf1/Y=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCICuDL752GtBomivZbiOJnGJT1E8XmnZnQveLTZd25p1ZAiBwZT4ArhXts5C735bhbA8qRgP/yjJTZwle+xVWZ5+BhQ=="}],"unpackedSize":56331},"main":"dist/5w-logger.js","name":"5w-logger","author":{"name":"Juhani Hakosalo"},"gitHead":"904a780a8d0f7ad8b6ed78019a9447e2639c8551","license":"MIT","scripts":{"lint":"eslint \"src/**/*.ts\"","test":"mocha --require ts-node/register src/*.spec.ts src/**/*.spec.ts","build":"npm run lint && tsc"},"typings":"dist/5w-logger.d.ts","version":"1.0.4","_npmUser":{"name":"heikkohoo","email":"juhani.hakosalo@gmail.com"},"homepage":"https://github.com/Heikkohoo/5w-logger#readme","overrides":{"mocha":{"diff":"8.0.4","serialize-javascript":"7.0.7"},"deepmerge-ts":"8.0.2","brace-expansion@>=4.0.0 <5.0.12":"5.0.12"},"repository":{"url":"git+https://github.com/Heikkohoo/5w-logger.git","type":"git"},"_npmVersion":"11.9.0","description":"5w logger library","directories":{},"maintainers":[{"name":"heikkohoo","email":"juhani.hakosalo@gmail.com"}],"_nodeVersion":"24.14.0","dependencies":{"uuid":"14.0.2"},"_hasShrinkwrap":false,"devDependencies":{"chai":"6.3.0","mocha":"11.8.0","globals":"^17.12.0","ts-node":"10.9.2","@eslint/js":"^10.0.1","typescript":"6.0.3","@types/chai":"5.2.3","@types/node":"26.6.4","@types/mocha":"10.0.10","typescript-eslint":"^8.68.0","eslint-plugin-functional":"^10.0.1","@typescript-eslint/parser":"^8.68.0","@typescript-eslint/eslint-plugin":"^8.68.0"},"x-overrides-note":"Keep these overrides while Mocha 11.x is in use; remove after upgrading to Mocha 12 stable or newer.","_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/5w-logger_1.0.4_1790946653203_0.4900582888987022"},"x-deepmerge-ts-override-note":"Use patched deepmerge-ts 8.0.2 to avoid downgrading eslint-plugin-functional."}},"time":{"created":"2026-03-30T08:51:56.156Z","modified":"2026-10-02T13:10:53.485Z","1.0.0":"2026-03-30T08:51:56.328Z","1.0.1":"2026-05-07T12:57:13.959Z","1.0.2":"2026-06-05T10:37:44.141Z","1.0.3":"2026-08-27T08:59:54.631Z","1.0.4":"2026-10-02T13:10:53.282Z"},"bugs":{"url":"https://github.com/Heikkohoo/5w-logger/issues"},"author":{"name":"Juhani Hakosalo"},"license":"MIT","homepage":"https://github.com/Heikkohoo/5w-logger#readme","repository":{"url":"git+https://github.com/Heikkohoo/5w-logger.git","type":"git"},"description":"5w logger library","maintainers":[{"name":"heikkohoo","email":"juhani.hakosalo@gmail.com"}],"readme":"# 5w Logger\n\n## How to use\n\n```javascript\n\n...\n\nimport * as logger from \"5w-logger\";\n\nconst requestId = req.requestId\nconst event = getMadeUpEvent()\nconst context = getMadeUpContext()\n\nconst logger = new logger.LogSpan(requestId)\n\nlogger.info(`lambda.handler.start`, `Calling Lambda callback.`, `request`, 'SYSTEM', { event, context })\nlogger.info(`lambda.handler`, `Logs have been parsed and transformed. Ready to push into separate destinations.`, `debug`)\nlogger.info(`lambda.handler.firehose`, `Pushing logs to Firehose.`, `debug`)\nlogger.error(`lambda.handler.firehose.catch`, `Could not push logs to Firehose.`, `debug`, system, { error })\n\n// Uh at this point I'm pretty sure you know how to use this... Try it out.\n\n...\n\n```\n\n## Target\n\nUse logging to ease debugging problems, improve security auditing, improve identifying problems in security, make logging compliant to ISO 27002 standard.\n\nSnippet from the Finnish Standards Association SFS's ISO 27002 description:\n\n    \"Event logs recording user activities, exceptions, faults and information security events should be produced, kept and regularly reviewed.\"\n\nLogs should answer to 5W or When (was the activity performed), Whence (the activity originated), Who (or what performed the activity), What (activity was performed), Where (in the system the activity got handled). Each activity should have its own unique identifier to ease the audit trail.\n\n5w Logger is inspired by checkout-logger TypeScript library (https://github.com/CheckoutFinland/checkout-logger)\n\n## Structure\n\n\n```\n{\n    \"timestamp\": \"2017-11-08T07:27:04+00:00\",\n    \"level\": \"info\" | \"debug\" | \"error\" | \"warning\",\n    \"rid\": \"1232131\",\n    \"type\": \"person.viewed\",\n    \"message\": \"the actual content that was logged for magic crap\",\n    \"group\": \"audit\" | \"request\" | \"response\" | \"debug\" | \"session\" | \"security\" | \"technical\",\n    \"user\": \"SYSTEM\",\n    \"meta\": {\n        \"some\": \"info\"\n    }\n}\n```\n\n### Timestamp\n\nWell formatted timestamp. Generated automatically.\n\n### Levels\n\nSupported log leves are `info`, `debug`, `error` and `warning`.\n\n* Error: Use when the system has run into a fatal exception that we cannot automatically recover from and require attention from developers.\n* Warning: Use for 90% of catch cases and error handling.\n* Info: Normal information type logging.\n* Debug: General developer friendly spam that is wanted in the logs for common \"what the hell just happened\" type of solving.\n\n### Request ID\n\nRequest ID from headers or request when it's available. Otherwise leave it empty and the Logger will generate a valid UUID-V4 for it.\n\n### Message\n\n\nFreeform message that should be unique and link you instantly to the case at hand. Requires the use of higher brain functionality to get in place properly. Think of it like well formatted Git commit messages.\n\n### Type\n\nLinks the case into a specific place in the system. For example `lambda.image_processing`, `chat_api`, and so on. Again, higher brain functionality should be used when naming this. Does not need to be as unique as RID or Message. It can be a function name from a specific piece of the software or a component name or something similar.\n\n### Group\n\n* There supported log groups are\n  * \"audit\"\n  * \"request\"\n  * \"response\"\n  * \"debug\"\n  * \"session\"\n  * \"security\"\n  * \"technical\"\n\n#### Audit\n\nUsed for specific auditing trail purposes. Everything that might require somewhat reasonable auditing trail.\n\n#### Request\n\nCan contain any linking information from the client sent Request. Aims to make the request debugging and observing easier. Make sure to strip out any sensitive inputs or mask them properly.\n\n#### Response\n\nCan contain any linking information from the information sent as Response to the client sent Request. Aims to make the response debugging and observing easier. Make sure to strip out any sensitive inputs or mask them properly.\n\n#### User\n\nThis can be a named user or \"SYSTEM\" to indicate the log row was written by the system and not directly caused by a user doing something.\n\n#### Meta\n\nMeta object. Can be any JSON document that is considered helpful in debugging and needed to maintain sensible logs. Make sure to strip out any sensitive inputs or mask them properly.\n\n","readmeFilename":"README.md"}