standard-log-console v1.3.6
standard-log-console
Console support for standard-log
.
This is the default reporter of standard-log
.
Installation
In normal use case you don't need to reference this library directly.
standard-log
exports the main features from standard-log-console
.
yarn add standard-log
If you want to access other features from stand-log-console
, you can install it directly:
yarn add standard-log-console
Usage
By default, standard-log
will use this reporter by default.
If you want to configure standard-log
to use other reporters programatically,
you can use the createConsoleLogReporter()
to create the reporter for console:
import {
createConsoleLogReporter,
config, // by `standard-log`
} from 'standard-log'
config({ reporters: [createConsoleLogReporter(), /* other reporters */] })
By default, it will use ansi formatter in NodeJS and css formatter in browser.
If you want to change that, or use your own formatter:
import { createConsoleLogReporter } from 'standard-log'
createConsoleLogReporter({
formatter: yourFormatter
})
For createCssFormatter()
, you can specify how many colors to use:
import { createCssFormatter } from 'standard-log'
createCssFormatter({ maxColor: 30 })
You can also configure the timestamp
format:
import { createAnsiFormatter, createCssFormatter } from 'standard-log'
createAnsiFormatter({ timestamp: 'none' })
createAnsiFormatter({ timestamp: 'iso' })
createAnsiFormatter({ timestamp: 'elasped' })
createCssFormatter({ timestamp: 'none' })
createCssFormatter({ timestamp: 'iso' })
createCssFormatter({ timestamp: 'elasped' })