Skip to content

Commit

Permalink
chore(pino-debug): add README
Browse files Browse the repository at this point in the history
  • Loading branch information
awlayton committed Apr 6, 2023
1 parent 1222e00 commit bcede51
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions oada/libs/pino-debug/README.md
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit bcede51

Please sign in to comment.