5.0.1 • Published 4 years ago

@ianwalter/log v5.0.1

Weekly downloads
1,770
License
SEE LICENSE IN LI...
Repository
github
Last release
4 years ago

@ianwalter/log

A tiny level-based console logger

npm page

Installation

yarn add @ianwalter/log

Usage

Basic

import log from '@ianwalter/log'

log.update({ level: 'warn' })

log.warn('Such logging!')

Using a custom logger (e.g. signale)

import log from '@ianwalter/log'
import signale from 'signale'

log.update({ types: Object.keys(signale._types), logger: signale })

log.complete('log can be used with signale')

Creating a separate, local logger

import log from '@ianwalter/log'

const localLog = log.create({ level: 'debug' })

localLog.debug('I am a debug statement')

Using namespaces

import log from '@ianwalter/log'

// Allows outputting log statements from loggers who have namespaces that match
// 'app.*'.
log.update({ unrestricted: 'app.*' })

// Create a logger that has an allowed namesapce.
const serverLog = log.ns('app.server')

// This log statement will be printed even though the log level is 'debug'.
serverLog.debug('I am a debug statement')

// So will this one.
log.ns('app.storage').debug('I, too, amd a debug statement')

License

Apache 2.0 with Commons Clause - See LICENSE

 

Created by Ian Walter

5.0.1

4 years ago

5.0.0

4 years ago

4.0.0

4 years ago

3.1.0

5 years ago

3.0.0

5 years ago

2.1.0

5 years ago

2.0.0

5 years ago

1.0.0

5 years ago