{"_id":"@macfja/pino-fingers-crossed","_rev":"3-a27f8bfa9d1241d34400743fae56e03c","name":"@macfja/pino-fingers-crossed","dist-tags":{"latest":"1.1.1"},"versions":{"1.0.0":{"name":"@macfja/pino-fingers-crossed","version":"1.0.0","keywords":["pino","transport","pino-transport","logger","fingers-crossed"],"author":{"name":"MacFJA"},"license":"MIT","_id":"@macfja/pino-fingers-crossed@1.0.0","maintainers":[{"name":"macfja","email":"macfja@gmail.com"}],"homepage":"https://github.com/MacFJA/js-pino-fingers-crossed","bugs":{"url":"https://github.com/MacFJA/js-pino-fingers-crossed/issues"},"dist":{"shasum":"3e0efb3e6a6349e50c64643b6138c76dfdf27428","tarball":"https://registry.npmjs.org/@macfja/pino-fingers-crossed/-/pino-fingers-crossed-1.0.0.tgz","fileCount":7,"integrity":"sha512-Fz5sxHMkVF2h3Q1IMAipizKQsbxkKE8/vOA9g0uKO5nK5iB1zPG+8Mi2Ixe8oHsHLTrLEvpe4rLDOIdWU/mt4A==","signatures":[{"sig":"MEQCIFIW4AcsKpdxLq5e8+dkkmW+UEUtc4Gm++4nJCHvxzg4AiA29uKSV4GdYakCJrr9oUHRqpTQOIJtOjGTCUoNLxIKGg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":15464},"main":"src/index.js","type":"module","_from":"file:macfja-pino-fingers-crossed-1.0.0.tgz","types":"src/index.d.ts","module":"src/index.js","exports":{".":{"types":["./src/index.d.ts"],"import":["./src/index.js"]},"./package.json":["./package.json"]},"scripts":{"fix":"biome check --write .","lint":"tsc --noEmit && biome check .","test":"ava src/index.spec.js","types":"tsc --emitDeclarationOnly"},"_npmUser":{"name":"macfja","email":"macfja@gmail.com"},"_resolved":"/tmp/b6a28035b4c04b669ebc2c5efe8acb04/macfja-pino-fingers-crossed-1.0.0.tgz","_integrity":"sha512-Fz5sxHMkVF2h3Q1IMAipizKQsbxkKE8/vOA9g0uKO5nK5iB1zPG+8Mi2Ixe8oHsHLTrLEvpe4rLDOIdWU/mt4A==","repository":{"url":"git+https://github.com/MacFJA/js-pino-fingers-crossed.git","type":"git"},"_npmVersion":"10.2.4","description":"A pino transport hold log until a log level is reach","directories":{},"_nodeVersion":"20.11.0","dependencies":{"pino":"^9.0.0"},"_hasShrinkwrap":false,"devDependencies":{"ava":"^6.1.3","sinon":"^18.0.0","typescript":"^5.5.3","@types/node":"^20.0.0","@biomejs/biome":"1.8.3"},"peerDependencies":{"pino":"^9.0.0"},"_npmOperationalInternal":{"tmp":"tmp/pino-fingers-crossed_1.0.0_1721491685433_0.36015167790854985","host":"s3://npm-registry-packages"}},"1.1.0":{"name":"@macfja/pino-fingers-crossed","version":"1.1.0","keywords":["pino","transport","pino-transport","logger","fingers-crossed"],"author":{"name":"MacFJA"},"license":"MIT","_id":"@macfja/pino-fingers-crossed@1.1.0","maintainers":[{"name":"macfja","email":"macfja@gmail.com"}],"homepage":"https://github.com/MacFJA/js-pino-fingers-crossed","bugs":{"url":"https://github.com/MacFJA/js-pino-fingers-crossed/issues"},"dist":{"shasum":"6cfafcf884e33f34791a24725b78b29fa2609571","tarball":"https://registry.npmjs.org/@macfja/pino-fingers-crossed/-/pino-fingers-crossed-1.1.0.tgz","fileCount":9,"integrity":"sha512-jZRjFmxGIixIa1wY5SFo2m4tsFFwMW+vfNftNMvIdKSSQx49F0MfsY3oDQN44KOK8jlqYYMJ4UUuy5MkOVzKgQ==","signatures":[{"sig":"MEUCICDXBMN189NDQjYK4/6qKSkt1UC2QG7K53n+JBDYBY5OAiEA7dVDcSGFM7mMDd/ZSYVxuWM16hKZCGfpv4iOI6tc7/E=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":23343},"main":"src/index.cjs","type":"module","types":"src/index.d.mts","module":"src/index.mjs","exports":{".":{"node":["./src/index.cjs"],"types":["./src/index.d.mts"],"import":["./src/index.mjs"],"default":["./src/index.cjs"],"require":["./src/index.cjs"]},"./package.json":["./package.json"]},"gitHead":"e3dbe66a7f43d2756ee515fade028ed2743caa87","scripts":{"cjs":"rollup src/index.mjs --format=cjs --file=src/index.cjs --external=pino --exports=named --no-esModule","fix":"biome check --write .","lint":"tsc --noEmit && biome check .","test":"ava src/index.spec.js","types":"tsc --emitDeclarationOnly","prepublishOnly":"npm run cjs && tsc --emitDeclarationOnly"},"_npmUser":{"name":"macfja","email":"macfja@gmail.com"},"repository":{"url":"git+https://github.com/MacFJA/js-pino-fingers-crossed.git","type":"git"},"_npmVersion":"10.2.4","description":"A pino transport hold log until a log level is reach","directories":{},"_nodeVersion":"20.11.0","dependencies":{"pino":"^9.0.0"},"_hasShrinkwrap":false,"devDependencies":{"ava":"^6.1.3","sinon":"^18.0.0","rollup":"^4.22.2","typescript":"^5.5.3","@types/node":"^20.0.0","@biomejs/biome":"1.8.3"},"peerDependencies":{"pino":"^9.0.0"},"_npmOperationalInternal":{"tmp":"tmp/pino-fingers-crossed_1.1.0_1726867054259_0.7882428842697822","host":"s3://npm-registry-packages"}},"1.1.1":{"name":"@macfja/pino-fingers-crossed","version":"1.1.1","description":"A pino transport hold log until a log level is reach","main":"src/index.cjs","module":"src/index.mjs","types":"src/index.d.mts","exports":{".":{"types":["./src/index.d.mts"],"import":["./src/index.mjs"],"require":["./src/index.cjs"],"node":["./src/index.cjs"],"default":["./src/index.cjs"]},"./package.json":["./package.json"]},"scripts":{"lint":"tsc --noEmit && biome check .","test":"ava src/index.spec.js","fix":"biome check --write .","types":"tsc --emitDeclarationOnly","cjs":"rollup src/index.mjs --format=cjs --file=src/index.cjs --external=pino --exports=named --no-esModule","prepublishOnly":"npm run cjs && tsc --emitDeclarationOnly"},"bugs":{"url":"https://github.com/MacFJA/js-pino-fingers-crossed/issues"},"homepage":"https://github.com/MacFJA/js-pino-fingers-crossed","repository":{"type":"git","url":"git+https://github.com/MacFJA/js-pino-fingers-crossed.git"},"type":"module","keywords":["pino","transport","pino-transport","logger","fingers-crossed"],"author":{"name":"MacFJA"},"license":"MIT","devDependencies":{"@biomejs/biome":"1.8.3","@types/node":"^20.0.0","ava":"^6.1.3","rollup":"^4.22.4","sinon":"^18.0.0","typescript":"^5.5.3"},"peerDependencies":{"pino":"^9.0.0"},"dependencies":{"pino":"^9.0.0"},"_id":"@macfja/pino-fingers-crossed@1.1.1","gitHead":"e1d8d9866e2075137872609c0f0bdc1e41501877","_nodeVersion":"20.18.1","_npmVersion":"10.8.2","dist":{"integrity":"sha512-ybPMhewHIoW4GOQZJvsw3tMoLqvBPYvqZ67l3al81BwVqGyzkX7A1aJtfW3iib7VT/1lnATaF6VoXg9OdfUuJw==","shasum":"1dfdd7e9ec44dc44f4cdc56e8876a38f8fecc3ac","tarball":"https://registry.npmjs.org/@macfja/pino-fingers-crossed/-/pino-fingers-crossed-1.1.1.tgz","fileCount":9,"unpackedSize":23841,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIF8vVgatin6ccHeTRuuOgUP/5F4UR7NF5piPSX9fIOqmAiEAmG6Q2Zihp0DaPOcZrm8UdSNGmtVBovv6ZZq00zaz3cc="}]},"_npmUser":{"name":"macfja","email":"macfja@gmail.com"},"directories":{},"maintainers":[{"name":"macfja","email":"macfja@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/pino-fingers-crossed_1.1.1_1746042731718_0.6742410327418287"},"_hasShrinkwrap":false}},"time":{"created":"2024-07-20T16:08:05.330Z","modified":"2025-04-30T19:52:12.100Z","1.0.0":"2024-07-20T16:08:05.695Z","1.1.0":"2024-09-20T21:17:34.470Z","1.1.1":"2025-04-30T19:52:11.924Z"},"bugs":{"url":"https://github.com/MacFJA/js-pino-fingers-crossed/issues"},"author":{"name":"MacFJA"},"license":"MIT","homepage":"https://github.com/MacFJA/js-pino-fingers-crossed","keywords":["pino","transport","pino-transport","logger","fingers-crossed"],"repository":{"type":"git","url":"git+https://github.com/MacFJA/js-pino-fingers-crossed.git"},"description":"A pino transport hold log until a log level is reach","maintainers":[{"name":"macfja","email":"macfja@gmail.com"}],"readme":"# Fingers Crossed transport for Pino\n\nA [pino](https://getpino.io/) transport hold log until a log level is reach. \n\n## Installation\n\n```shell\nnpm install @macfja/pino-fingers-crossed\n```\n\n## Why\n\nIn most case, you don't need logs to tell you every step and detail about your normally operating application.\n\nBut when an error occurs you want the maximum data possible.\n\nHere enter the Fingers Crossed transport, it will hold all messages until a threshold, and there release all messages it has.\nSo you can add all the log you want in your code, and you will have them only when needed.\n\n## Usage\n\nTo add the fingers-crossed feature to pino, you need to wrap your pino transport in the _default_ function of the library.\n\n> [!NOTE]\n> If you don't specify a transport, the standard output will be used.\n\nBy default, the transport will not hold any log, to activate the feature you need to add a binding,\nthe name of the binding is the variable `enable` from the library,\nand the value is minimum log level to reach to release all the message in the queue.\n\n> [!NOTE]\n> This added binding will not appear in your logs \n\nEach logger (the current one or its child) will have its separated message queue, so logging a message that trigger a messages release will only be for the logger that log it, and not any of its parents.\nEvery child can have its own message level to trigger the queue. You can even change it on the fly (note that only new log can trigger a queue release), you just have to redeclare the binding. \n\n> [!TIP]\n> It's best suited if you create a new child logger for each business event that you receive (it can be a HTTP request, cron task, MQ message, etc.)\n\nYou can deactivate the feature by setting the trigger level to `false`.\n\nIf your logger have the feature activated, but you still want to log directly a message, you can pass the trigger level to `false` in the first parameter of the logging function\n(see example below)\n\n### Example\n\n```ts\nimport pino from \"pino\"\nimport fingersCrossed, { enable } from \"@macfja/pino-fingers-crossed\"\n\nconst logger = pino(fingersCrossed());\n\nlogger.info('Will appear immedialty')\nlogger.error('Will appear immedialty')\n\nlogger.setBindings({ [enable]: 50 })\nlogger.info('Will NOT appear immedialty')\nlogger.info('Will NOT appear immedialty')\nlogger.error('Will appear immedialty as well as the 2 previous messages') // error log are level 50\nlogger.info('Will NOT appear')\nlogger.info({ [enable]: false }, 'Will appear immedialty')\nlogger.info('Will NOT appear')\n\nconst child = logger.child({ [enable]: 60 }, { msgPrefix: '(child) ' })\nchild.info('Will NOT appear immedialty')\nchild.error('Will NOT appear immedialty')\nchild.info('Will NOT appear immedialty')\nchild.fatal('Will appear immedialty as well as the 3 previous messages') // fatal log are level 60\nchild.warn('Will NOT appear')\n\nconst great_child = child.child({ [enable]: 40 }, { msgPrefix: '(great child) ' })\ngreat_child.info('Will NOT appear immedialty')\ngreat_child.error('Will appear immedialty as well as the previous message') // error log are level 50\ngreat_child.warn('Will appear immedialty') // warn log are level 40\ngreat_child.info('Will NOT appear')\n```\n\nMore examples:\n - [With Fastify](./doc/Fastify.md)\n - [With Express 4.x](./doc/Express4.md)\n\n## Memory\n\nThe message of a Logger is keep in memory (if the `[enable]` binding is defined) until the trigger is reach.\n\nBut all messages are deleted from memory if the logger is freed with the Garbage Collector.\nFor example, if you create a new logger (or child logger) inside a function, all messages not send at the end of the function will be removed (without being outputted).\n\n","readmeFilename":"README.md"}