New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

enrise-logger

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

enrise-logger

Logger used within Enrise projects and module's

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6
increased by20%
Maintainers
1
Weekly downloads
 
Created
Source

Node.js logger module

build:? Coverage Status dependencies:? devDependencies:?

A simple wrapper around winston.

Installation

NPM: npm install enrise-logger --save
Yarn: yarn add enrise-logger

Initialization and usage

At the beginning of your application, be sure to initialize the logger:
require('enrise-node-logger')([config: Object]);

Where config is an optional object. See below for further instructions.

After the module is initialized, simply call .get(name: String) on the module to return a namespaced logger:
const log = require('enrise-node-logger').get('MyLogger');

The log object contains functions for each log-level:

  • log.info('Some log message');
  • log.error(new Error('Some error'));

Configuration

The default configuration looks as follows. Everything can be overwritten on initialization.

{
  transports: ['Console'],
  getConsoleConfig: (config) => {
    return config.console;
  },
  getLogstashUDPConfig: (config) => {
    return config.logstash;
  },
  winston: {
    console: {
      level: 'info',
      colorize: true
    },
    logstash: {}
  },
  levels: {
    error: 0,
    warn: 1,
    help: 2,
    data: 3,
    info: 4,
    trace: 5,
    debug: 6,
    prompt: 7,
    verbose: 8
  }
}
transports

Define all transports that the logger should use. Defaults to only the Console. The other possible transport is LogstashUDP. These can be used together.

getConsoleConfig & getLogstashUDPConfig

Overwrite and modify the configuration used for their corresponding transport. The config object is always a clone of the config.winston object.

winston

An object with specific configuration for the transporters.

levels

The node-logger uses more detailed log-levels than winston does. The higher the priority the more important the message is considered to be, and the lower the corresponding integer priority. These levels can be modified to your liking.

FAQs

Package last updated on 01 Nov 2016

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