3.0.3 • Published 4 years ago

verbosity v3.0.3

Weekly downloads
48
License
MIT
Repository
github
Last release
4 years ago

verbosity

An augmented drop-in console replacement that supports logging levels.

Publishing Status

npm Libraries.io
Travis Rollup

Development Status

Travis Libraries.io
Snyk Code-Climate Code-Climate Coverage

Documentation/Help

Inch.io Twitter

Usage

About

I wanted to be able to have chattier daemons running in development, and more succinct logging in production but wanted to keep the simplicity of using console.log() etc.

Normally I pass in a granular verboseness level via arguments to control the verbosity level for the running process.

Installation

npm install --save verbosity

Examples

Simply override the built in console object:

import {createConsole} from 'verbosity'

const console = createConsole({
  outStream: process.stdout,
  errorStream: process.stderr,
  verbosity: 5
})

console.log('Works like normal...')
console.debug('...but now controllable.')

console.verbosity(3) // Use numbered levels 5 (debug) to 1 (error)

console.debug('...this isn’t printed now.')

console.canWrite(5) && console.dir({print: 'this won’t.'})

console.verbosity('debug') // Use named levels [debug, info, log, warning, error]

console.canWrite(5) && console.dir({print: 'this will now.'})

This will direct all console output to stderr, but silence 'info' and 'debug' messages.

import {createConsole} from 'verbosity'

const console = createConsole({
  outStream: process.stderr,
  verbosity: 3
})

console.log('Picked brown jacket...') // Printed
console.debug('Purple tie chosen...') // Not printed
console.warn("That tie doesn't go with that jacket.") // Printed

Or go mad with making up any number of custom console writers.

import {createConsole} from 'verbosity'

const myUberConsole = createConsole({
  outStream: myFancyWriteableStream,
  verbosity: 5
})

myUberConsole.panic('Core Flux Capacitor Meltdown!')

Documentation

Full documentation can be found at https://thebespokepixel.github.io/verbosity/

3.0.3

4 years ago

3.0.2

4 years ago

3.0.1

4 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.2.0

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.10.1

6 years ago

0.10.0

7 years ago

0.9.2

7 years ago

0.9.1

7 years ago

0.9.0

7 years ago

0.8.4

9 years ago

0.8.3

9 years ago

0.8.2

9 years ago

0.8.1

9 years ago

0.8.0

9 years ago

0.8.0-beta.3

9 years ago

0.8.0-beta.2

9 years ago

0.8.0-beta.1

9 years ago

0.8.0-beta.0

9 years ago

0.7.1

9 years ago

0.7.0

9 years ago

0.6.1

9 years ago

0.6.0

9 years ago

0.5.1

9 years ago

0.5.0

9 years ago

0.4.5

9 years ago

0.4.4

9 years ago

0.4.3

9 years ago

0.4.2

9 years ago

0.4.1

9 years ago

0.4.0

9 years ago

0.3.0

10 years ago

0.2.6

10 years ago

0.2.5

10 years ago

0.2.4

10 years ago

0.2.3

10 years ago

0.2.2

10 years ago

0.2.1

10 years ago

0.2.0

10 years ago