Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@timberio/bunyan

Package Overview
Dependencies
Maintainers
5
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@timberio/bunyan

Timber.io - Bunyan writable stream

  • 0.35.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
5
Weekly downloads
 
Created
Source

🌲 Timber - Bunyan writable stream

Beta: Ready for testing Speed: Blazing ISC License

New to Timber? Here's a low-down on logging in Javascript.

@timberio/bunyan

This NPM library provides a Bunyan writable stream that transmits logs to Timber.io via the @timberio/node logger.

Here's how to get started:

Installation

Install the Node.js Timber logger and the Bunyan stream plugin via NPM:

npm i @timberio/node @timberio/bunyan

Importing

In ES6/Typescript, import both the Timber logger class and the Timber Bunyan stream class:

import { Timber } from "@timberio/node";
import { TimberStream } from "@timberio/bunyan";

For CommonJS, require the packages instead:

const { Timber } = require("@timberio/node");
const { TimberStream } = require("@timberio/bunyan");

Creating a client/stram

You can create a client the usual way for @timberio/node, and then pass it into a new instance of TimberStream:

// Assuming you've imported the Timber packages above, also import Bunyan...
import bunyan from "bunyan";

// Create a Timber client
const timber = new Timber("timber-organization-key", "timber-source-key");

// Create a Bunyan logger - passing in the Timber stream
const logger = bunyan.createLogger({
  name: "Example logger",
  level: "debug",
  streams: [
    {
      stream: new TimberStream(timber)
    }
  ]
});

// Log as normal in Bunyan - your logs will sync with Timber.io!
logger.info("Hello from Bunyan");

Log levels

Timber will log at the debug level and above. Trace logs or any log level below 20 will be ignored.

The fatal log level is transformed to error in the Timber logger.

LICENSE

ISC

Keywords

FAQs

Package last updated on 19 Aug 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc