# bunyan-serializer

> a lightweight module to pretty print a bunyan stream.

Latest version **0.1.10** (published 2016-05-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install bunyan-serializer
pnpm add bunyan-serializer
yarn add bunyan-serializer
bun add bunyan-serializer
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.10 |
| Published | 2016-05-26 |
| First published | 2016-05-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Cole Chamberlain |
| Maintainers | cchamberlain |
| Keywords | bunyan, stream, serialize, serialization, deserialize, deserialization, pretty, WritableStream, EventEmitter |

## Links

- npm: https://www.npmjs.com/package/bunyan-serializer
- Repository: https://github.com/cchamberlain/bunyan-serializer
- Homepage: http://bunyan-serializer.js.org
- Issues: https://github.com/cchamberlain/bunyan-serializer/issues
- npm.io page: https://npm.io/package/bunyan-serializer

## Recent versions

- 0.1.10 (latest) — 2016-05-26
- 0.1.9 — 2016-05-26
- 0.1.8 — 2016-05-26
- 0.1.7 — 2016-05-26
- 0.1.6 — 2016-05-26
- 0.1.5 — 2016-05-26
- 0.1.4 — 2016-05-26
- 0.1.3 — 2016-05-26
- 0.1.2 — 2016-05-26
- 0.1.1 — 2016-05-26

## README

# bunyan-serializer

**bunyan-serializer is a lightweight module to pretty print a bunyan stream.**

**Dependences: none**

[![NPM](https://nodei.co/npm/bunyan-serializer.png?stars=true&downloads=true)](https://nodei.co/npm/bunyan-serializer/)

## Install

`npm i -S bunyan-serializer`


## Documentation

This module creates a serializer that prints a bunyan stream in a human readable format. It was created for situations where you want readable log text and you aren't running bunyan from the CLI (cannot pipe to bunyan for pretty-printing).

I may add other formats down the road if there is a need for them so I've tried to setup its API to be as future proof as possible.


## How to use

```js
import { createPrettySerializer } from 'bunyan-serializer'

/** Optional parameters shown are the defaults if any or all are omitted. */
const serializer = createPrettySerializer({ showName: false
                                          , showHostname: false
                                          , showPid: true
                                          , showTime: true
                                          , showError: true
                                          , showSilly: false
                                          })


// ... within bunyan stream

  write = (...args) => {
    try {
      // dispatch a human readable string to whatever media the stream is targeted at.
      res.send(serializer(...args))
    } catch(err) {
      this.error(err)
      return false
    }
    return true
  };

// ...

```


## Options

**createPrettySerializer takes the following options:**

Name            | Type (default)    | Description
-------------   | ----------------- | -----------
`showName`      | `Boolean (false)` | Show the name of the logger in logs.
`showHostname`  | `Boolean (false)` | Show the hostname in logs.
`showPid`       | `Boolean (true)`  | Show the process id in logs.
`showTime`      | `Boolean (true)`  | Show the time in logs.
`showError`     | `Boolean (true)`  | Show error details in logs.
`showSilly`     | `Boolean (false)` | Show extra debug information (for development / debugging purposes)

---
_Source: https://npm.io/package/bunyan-serializer · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
