From bcede51d784126b9ebbdd0a48c8ac8cb204b043e Mon Sep 17 00:00:00 2001 From: Alex Layton Date: Thu, 6 Apr 2023 09:48:30 -0400 Subject: [PATCH] chore(pino-debug): add README --- oada/libs/pino-debug/README.md | 46 ++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 oada/libs/pino-debug/README.md diff --git a/oada/libs/pino-debug/README.md b/oada/libs/pino-debug/README.md new file mode 100644 index 00000000..94359813 --- /dev/null +++ b/oada/libs/pino-debug/README.md @@ -0,0 +1,46 @@ +# @oada/pino-debug + +[![Version](https://img.shields.io/npm/v/@oada/pino-debug.svg)](https://npmjs.org/package/@oada/pino-debug) +[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier) +[![License](https://img.shields.io/github/license/OADA/server)](LICENSE) + +A library for handle making +[debug.js][] work automatically with [pino][]. + +## Usage + +Import this library, +then just use [debug.js][] as normal. + +```typescript +// You probably want this to be your first import in your main file +import '@oada/pino-debug'; + +// Then just use debug.js as normal +import debug from 'debug'; + +const info = debug('example:info'); + +// Pass a context object and a message string +info({/* ...context */});, 'Hello world!'); +``` + +### Advanced Usage + +The [pino][] API can still be accessed too. + +```typescript +// If you want to access pino, it is exported by this lib +import { pino } from '@oada/pino-debug'; + +/** + * See the pino API for what you can do + * !!! DO NOT import pino directly !!! + */ +const logger = pino({ + /* ...options */ +}); +``` + +[debug.js]: https://github.com/debug-js/debug +[pino]: https://github.com/pinojs/pino