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

isolog

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

isolog

JS logger

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

###Installation

npm install --save-dev isolog

###Usage

First one or more handlers must be added to the Logger.

import { Logger, ConsoleHandler } from "isolog";

var config = {LOG_LEVEL: 200};

var handler = new ConsoleHandler(config);

Logger.addHandler(handler);

Each handler accepts a configration object which will typically contain a LOG_LEVEL property. If no LOG_LEVEL is provided then it will default to 100;

Subsequent modules can simply import the logger and invoke one of the 5 methods:

import { Logger } from "isolog";

Logger.debug('debug');
Logger.info('info');
Logger.warn('warn');
Logger.error('error');
Logger.critical('critical');

Data will only be logged if the method invoked exceeds the level set on the handler.

The default log levels are:

{
    debug: 100,
    info: 200,
    warn: 300,
    error: 400,
    critical: 500
}

It's possible to override these on a per handler basis by passing in a LEVELS object as a property on the configuration object.

###Custom handlers

A valid handler must extend the BaseHandler and implement the handle method: abstract handle (data: any): void

Keywords

FAQs

Package last updated on 29 Jan 2018

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