0.0.2 • Published 6 years ago

@seanmcp/time-console v0.0.2

Weekly downloads
1
License
ISC
Repository
-
Last release
6 years ago

time-console

Add a time stamp and color to all your console messages.

Color-coded console messages with time stamps

Why?

I like coloring and time-stamping my console messages in a particular way while preserving the default console methods. If you are okay with monkey patching, checkout the more popular console-stamp or log-timestamp.

Documentation

Install

npm i --save @seanmcp/time-console

Use

const { log } = require('@seanmcp/time-console')()

log('Hello world!')
// -> [22:39:06:947] Hello world!

Four console methods are exposed:

  • error: red
  • info: cyan
  • log: gray
  • warn: yellow

Customize

For a different date format, pass you preferred a date format string to the higher-order function:

const { error } = require('@seanmcp/time-console')('YY/MM/DD HH:mm:ss')

error('Error!')
// -> [19/05/31 23:34:08] Error!