diff --git a/src/docs/example.md b/src/docs/example.md index 4e2ae45..e7fd812 100644 --- a/src/docs/example.md +++ b/src/docs/example.md @@ -1,3 +1,9 @@ +#### 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 ```shell @@ -16,6 +22,19 @@ const console = createConsole({ errorStream: process.stderr, verbosity: 5 }) + +console.log('Works like normal...') +console.debug('...but now controllable.') + +console.verbosity(3) + +console.debug('...this isn’t printed now.') + +console.canWrite(5) && console.dir({print: 'this won’t.'}) + +console.verbosity(5) + +console.canWrite(5) && console.dir({print: 'this will now.'}) ``` This will direct all console output to stderr, but silence 'info' and 'debug' messages. diff --git a/test/logging.js b/test/logging.js index 4ec8990..a9b779b 100644 --- a/test/logging.js +++ b/test/logging.js @@ -95,10 +95,8 @@ runSuite( createConsole({outStream: StreamProxy}) ) - runSuite( 'Timestamp', createConsole({outStream: StreamProxy, timestamp: 'XX:XX:XX'}), `[${chalk.dim('XX:XX:XX')}] ` ) -