🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

bunyan-config

Package Overview
Dependencies
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bunyan-config

Converts JSON configuration into a proper bunyan configuration object.

latest
Source
npmnpm
Version
0.2.0
Version published
Maintainers
2
Created
Source

bunyan-config

This module converts JSON configuration into a proper bunyan configuration object.

It is useful when you want/need to restrict your configuration to a JSON object, where you cannot reference process.stdout or instantiate plugins.

Installation

npm install bunyan-config --save

Usage

var jsonConfig = {
    name: 'myLogger',
    streams: [{
        stream: 'stdout' // shorthand config
    }, {
        stream: { name: 'stderr' } // full version
    }, {
        type: 'raw',
        stream: { // full version with params
            name: 'bunyan-logstash',
            // The value of `streamParams` is stream-specific.
            params: {
                host: 'localhost',
                port: 5005
            }
        }
    }, {
        type: 'raw',
        stream: {
            name: 'bunyan-redis',
            params: {
                host: 'localhost',
                port: 6379
            }
        }
    },
    
    serializers: {
        req: 'bunyan:stdSerializers.req',
        fromNodeModules: 'someNodeModule',
        fromNodeModulesWithProps: 'someNodeModule:a.b.c',
        custom: './lib/customSerializers:custom',
        another: './lib/anotherSerializer',
        absolutePath: '/path/to/serializer:xyz'
    }
    // or
    serializers: 'module:property.parent.child' // relative and absolute module references are also supported
]};

var bunyanConfig = require('bunyan-config')(jsonConfig);

var logger = require('bunyan').createLogger(bunyanConfig); 

Supported streams

  • stdout
  • stderr
  • bunyan-logstash
  • bunyan-redis
  • bunyan-logentries

Please submit pull requests with support for additional streams.

Supported serializers

Any serializer exposed as a node module or as a (deep) property on any node module.

Relative module references are resolved from the current working directory.

Keywords

bunyan

FAQs

Package last updated on 06 Dec 2015

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