README
standard-log-color
Color console reporter for standard-log
.
Installation
npm install standard-log-color
yarn add standard-log-color
Usage
If installed, this will be used as the default reporter of standard-log
To customize:
import { config } from 'standard-log'
import { createColorLogReporter } from 'standard-log-color'
config({ reporters: [createColorLogReporter({ ... }), /* other reporters if needed */] })
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 { createColorLogReporter } from 'standard-log-color'
createColorLogReporter({
formatter: yourFormatter
})
For createCssLogFormatter()
, you can specify how many colors to use:
import { createCssLogFormatter } from 'standard-log-color'
createCssLogFormatter({ maxColor: 30 })
You can also add timestamp
:
import { createAnsiLogFormatter, createCssLogFormatter } from 'standard-log-color'
createAnsiLogFormatter({ timestamp: 'none' })
createAnsiLogFormatter({ timestamp: 'iso' })
createAnsiLogFormatter({ timestamp: 'elapsed' })
createCssLogFormatter({ timestamp: 'none' })
createCssLogFormatter({ timestamp: 'iso' })
createCssLogFormatter({ timestamp: 'elapsed' })