Skip to content

Commit

Permalink
doc: Add Transport @macfja/pino-fingers-crossed (#2047)
Browse files Browse the repository at this point in the history
  • Loading branch information
MacFJA authored Sep 23, 2024
1 parent 0ab1bdd commit cd09737
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions docs/transports.md
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ PRs to this document are welcome for any new transports!
+ [pino-logfmt](#pino-logfmt)
+ [pino-telegram-webhook](#pino-telegram-webhook)
+ [pino-yc-transport](#pino-yc-transport)
+ [@macfja/pino-fingers-crossed](#macfja-pino-fingers-crossed)
### Legacy
Expand Down Expand Up @@ -1119,6 +1120,29 @@ logger.error(new Error("error"));
logger.fatal("fatal");
```
<a id="macfja-pino-fingers-crossed"></a>
### @macfja/pino-fingers-crossed
[@macfja/pino-fingers-crossed](https://github.com/MacFJA/js-pino-fingers-crossed) is a Pino v7+ transport that holds logs until a log level is reached, allowing to only have logs when it matters.
```js
const pino = require('pino');
const { default: fingersCrossed, enable } = require('@macfja/pino-fingers-crossed')

const logger = pino(fingersCrossed());

logger.info('Will appear immedialty')
logger.error('Will appear immedialty')

logger.setBindings({ [enable]: 50 })
logger.info('Will NOT appear immedialty')
logger.info('Will NOT appear immedialty')
logger.error('Will appear immedialty as well as the 2 previous messages') // error log are level 50
logger.info('Will NOT appear')
logger.info({ [enable]: false }, 'Will appear immedialty')
logger.info('Will NOT appear')
```
<a id="communication-between-pino-and-transport"></a>
## Communication between Pino and Transports
Here we discuss some technical details of how Pino communicates with its [worker threads](https://nodejs.org/api/worker_threads.html).
Expand Down

0 comments on commit cd09737

Please sign in to comment.