npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

fable-log-logger-bunyan

v1.0.5

Published

Bunyan logger for fable-log.

Downloads

1,032

Readme

Fable Log Logger Bunyan

A Bunyan log provider for fable-log. Outputs structured JSON logs through the standard fable logging interface, supporting all six log levels and custom stream configurations.

npm version License: MIT


Features

  • Structured JSON Logging - All log output is Bunyan-format JSON with timestamps, level numbers, hostnames, and PIDs
  • Fable Log Provider - Extends the fable-log LogProviderBase, plugging directly into the fable logging pipeline
  • Six Log Levels - trace, debug, info, warn, error, and fatal mapped to their Bunyan equivalents
  • Object Context - Attach arbitrary data objects to any log call; they are merged into the JSON output
  • Custom Streams - Pass Bunyan stream configurations (stdout, files, rotating files, ringbuffers) through the settings object
  • Datum Decorators - Works with fable-log's setDatumDecorator to enrich log objects with application metadata

Installation

npm install fable-log-logger-bunyan

Quick Start

const libFable = require('fable');
const libFableLoggerBunyan = require('fable-log-logger-bunyan');

let fable = new libFable(
{
	Product: 'my-app',
	Version: '1.0.0',
	LogStreams: []
});

// Create the bunyan logger — settings are passed directly to Bunyan
let bunyanLogger = new libFableLoggerBunyan(
{
	name: fable.settings.Product
});

// Add it to the fable logging pipeline
fable.Logging.addLogger(bunyanLogger, 'trace');

// Log away
fable.log.info('Application started.');
fable.log.info('User loaded:', { id: 42, name: 'Ada' });
fable.log.error('Something went wrong!');

Usage

Custom Streams

Bunyan stream configurations are passed directly through the settings object:

const { PassThrough } = require('stream');
const logCapture = new PassThrough();

let bunyanLogger = new libFableLoggerBunyan(
{
	name: 'my-app',
	streams:
	[
		{ level: 'trace', stream: process.stdout },
		{ level: 'info', stream: logCapture },
		{ level: 'error', path: '/var/log/my-app-error.log' }
	]
});

fable.Logging.addLogger(bunyanLogger, 'trace');

Datum Decorators

Use fable-log's datum decorator to enrich every log entry with application context:

fable.log.setDatumDecorator((pSourceDatum) =>
{
	return {
		Source: fable.settings.Product,
		Meta: pSourceDatum
	};
});

fable.log.info('Hello!', { requestId: 'abc-123' });
// JSON output includes Source, Meta.requestId, msg, level, time, etc.

API

Constructor

new BunyanLogger(pLogStreamSettings, pLogStreamHash)

| Parameter | Type | Description | |-----------|------|-------------| | pLogStreamSettings | Object | Settings passed directly to bunyan.createLogger() (must include name) | | pLogStreamHash | String | Optional hash identifier for the log stream |

Log Methods

All methods accept a log message string and an optional context object:

| Method | Bunyan Level | Description | |--------|-------------|-------------| | trace(pLogText, pLogObject) | 10 | Finest-grain debug output | | debug(pLogText, pLogObject) | 20 | Debug-level messages | | info(pLogText, pLogObject) | 30 | Informational messages | | warn(pLogText, pLogObject) | 40 | Warning conditions | | error(pLogText, pLogObject) | 50 | Error conditions | | fatal(pLogText, pLogObject) | 60 | Fatal / unrecoverable errors |

Properties

| Property | Type | Description | |----------|------|-------------| | bunyanLogger | Object | The underlying Bunyan logger instance |

Part of the Retold Framework

Fable Log Logger Bunyan is a logging provider in the Fable ecosystem:

Testing

Run the test suite:

npm test

Run with coverage:

npm run coverage

Related Packages

License

MIT

Contributing

Pull requests are welcome. For details on our code of conduct, contribution process, and testing requirements, see the Retold Contributing Guide.