Now Playing Mario

    @seanmcp/time-console

    0.0.2 • Public • Published

    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!

    Keywords

    none

    Install

    npm i @seanmcp/time-console

    DownloadsWeekly Downloads

    2

    Version

    0.0.2

    License

    ISC

    Unpacked Size

    2.83 kB

    Total Files

    3

    Last publish

    Collaborators

    • seanmcp