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

monogatari

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

monogatari

Opinionated logger with chalk.js

latest
Source
npmnpm
Version
0.0.3
Version published
Weekly downloads
7
-46.15%
Maintainers
1
Weekly downloads
 
Created
Source

Install

yarn add monogatari

Comes with chalk as a dependency.

Usage

import Logger from 'monogatari';

const logger = new Logger();
logger.error(new Error('This is an error object’s trace.'));
logger.error('This is an error message.');
logger.warning({ a: 'Oh, no, a warning within an object'});
logger.success('All good!');
logger.debug('Some debug info');
logger.debug({ firstName: 'Jon', email: 'jon@gmail.com' });

Configuring and Disabling in Production

When you define a new instance of the logger, you can provide a configuration object in the constructor to customize the behaviour based on the environment.

import Logger from 'monogatari';

// If env is "production" then logger looks at the enabledInProduction flag. 
// Everything is turned off by default and you must override with the keys you want to be logged.
// For example:
const logger = new Logger({
  env: process.env.NODE_ENV,
  enabledInProduction: {
    error: true,
    warning: true,
  }
});

// visible if env is "production"
logger.error('This is an error message.');
logger.warning({ a: 'Oh, no, a warning within an object'});

// not visible if env is "production"
logger.success('All good!');
logger.debug('Some debug info')

Keywords

logger

FAQs

Package last updated on 10 Apr 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