standard-log-color

Color console reporter for `standard-log`

Usage no npm install needed!

<script type="module">
  import standardLogColor from 'https://cdn.skypack.dev/standard-log-color';
</script>

README

standard-log-color

NPM version NPM downloads

Github NodeJS Codecov Codacy Grade Badge Codacy Coverage Badge

Greenkeeper

Visual Studio Code Wallaby.js

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 })

CSS example

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' })

timestamp example