fancy-format-log

3.0.0 • Public • Published

fancy-format-log

Log things, prefixed with a customized format timestamp

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

/fancy-format-log/

    Package Sidebar

    Install

    npm i fancy-format-log

    Weekly Downloads

    2

    Version

    3.0.0

    License

    MIT

    Unpacked Size

    5.19 kB

    Total Files

    4

    Last publish

    Collaborators

    • litomore