Skip to content

Commit

Permalink
Update example, fix xo
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkGriffiths committed Feb 15, 2019
1 parent 84962b2 commit 0f733f2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
19 changes: 19 additions & 0 deletions src/docs/example.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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.
Expand Down
2 changes: 0 additions & 2 deletions test/logging.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,8 @@ runSuite(
createConsole({outStream: StreamProxy})
)


runSuite(
'Timestamp',
createConsole({outStream: StreamProxy, timestamp: 'XX:XX:XX'}),
`[${chalk.dim('XX:XX:XX')}] `
)

0 comments on commit 0f733f2

Please sign in to comment.