3.0.0 • Published 4 years ago

fancy-format-log v3.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

fancy-format-log

npm.io npm.io npm.io npm.io

Log things, prefixed with a customized format timestamp

npm.io

Install

$ npm install fancy-format-log

Usage

const format = require('fancy-format-log')

const options = {
  format: 'YYYY-MM-DD HH:mm:ss:ms',   // Optional - Default is 'HH:mm:ss'
  style: 'dim.green'                  // Optional - Default is 'grey'
}

const f = format(options)

f.log('a message')
f.error('oh no!')

Valid patterns

  • YYYY: full year
  • MM: month
  • DD: day
  • HH: hours
  • mm: minutes
  • ss: seconds
  • ms: milliseconds

Valid styles

See chalk-pipe valid styles.

Example

Here is example.

API

f.log(msg...)

Logs the message as if you called console.log but prefixes the output with the current time.

f.error(msg...)

Logs the message as if you called console.error but prefixes the output with the current time.

f.warn(msg...)

Logs the message as if you called console.warn but prefixes the output with the current time.

f.info(msg...)

Logs the message as if you called console.info but prefixes the output with the current time.

f.dir(msg...)

Logs the message as if you called console.dir but prefixes the output with the current time.

Related

  • chalk-pipe - Create chalk style schemes with simpler style strings
  • fancy-log - Log things, prefixed with a timestamp

License

MIT © LitoMore