New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

astroflow

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

astroflow

Fast, elegant, structured and pluggable logging for Javascript

latest
Source
npmnpm
Version
0.8.1
Version published
Maintainers
1
Created
Source

Astroflow

Make logging great again

NPM Package NPM Release

NPM

Quickstart

$ npm i astroflow
const { log } = require('astroflow');

const log2 = log.with({ num: 2 });

log.info('hello world');
log2.info('hello world');
log.with({ lol: 42 }).error('fatal knock out');
log2.with({ num: 3, pi: 3.14 }).info('hello world');
log2.info('hello world');
log2.track({ description: 'event without message nor level' });

Configuration

// default configuration
const options = {
  level: Level.DEBUG,
  fields: {},
  writer: isBrowser ? console : stdout,
  insert_timestamp: true,
  timestamp_field_name: 'timestamp',
  message_field_name: 'message',
  level_field_name: 'level',
  hooks: [],
};

log.config(options);

Log usage

log.config(options: any)
log.with(fields: any): Logger
log.debug(message: string)
log.info(message: string)
log.warn(message: string)
log.error(message: string)
log.fatal(message: string) // log with the "fatal" level then exit(1)
log.track(fields: any) // log an event without level nor message

Examples

See the examples folder

Keywords

logs

FAQs

Package last updated on 03 Nov 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