Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including bunyan-serializer with all npm packages installed. Try it out:

var bunyanSerializer = require("bunyan-serializer")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

bunyan-serializer v0.1.10

a lightweight module to pretty print a bunyan stream.


bunyan-serializer is a lightweight module to pretty print a bunyan stream.

Dependences: none



npm i -S bunyan-serializer


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

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.
    } catch(err) {
      return false
    return true

// ...


createPrettySerializer takes the following options:

NameType (default)Description
showNameBoolean (false)Show the name of the logger in logs.
showHostnameBoolean (false)Show the hostname in logs.
showPidBoolean (true)Show the process id in logs.
showTimeBoolean (true)Show the time in logs.
showErrorBoolean (true)Show error details in logs.
showSillyBoolean (false)Show extra debug information (for development / debugging purposes)
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free