0.8.1 • Published 6 years ago

astroflow v0.8.1

Weekly downloads
2
License
Apache-2.0
Repository
github
Last release
6 years ago

Astroflow

Make logging great again

NPM Package NPM Release

NPM

  1. Quickstart
  2. Configuration
  3. Log usage
  4. Examples

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

0.8.1

6 years ago

0.8.0

6 years ago

0.7.4

6 years ago

0.7.3

6 years ago

0.7.2

6 years ago

0.7.1

6 years ago

0.7.0

6 years ago

0.6.5

6 years ago

0.6.4

6 years ago

0.6.3

6 years ago

0.6.2

6 years ago

0.6.1

6 years ago

0.6.0

6 years ago

0.1.0

6 years ago

0.0.1

6 years ago