Get unlimited public & private packages + team-based management with npm Teams.Learn more »

log-a-log

6.1.0 • Public • Published

Log-a-log

Build Status NPM version

A simple logger and optional decorator for console.log() and company.

Installation

npm install log-a-log

Modes

There are a number of operational modes, configured via the mode parameter:

  • utc - the default mode, which renders a ISO-8601 UTC timestamp in a single color
  • local - renders a local, ISO-8610 timestamp
  • unix - renders a millisecond-granularity unix timestamp
  • coded - renders a color-coded, local, ISO-8601 timestamp
  • pony - renders a very colorful, local, ISO-8601 timestamp

Configuration

Uses @buzuli/color, so colors can be configured to your preference (https://www.npmjs.com/package/@buzuli/color#configuration).

Example

const logalog = require('log-a-log')
 
logalog({mode: 'local', alias: 'my-script'})
 
const name = "world"
 
console.log(`Hello, ${name}!`)
console.error(`Oh noes, ${name}!`)

Sample Output:

[2015-10-30T21:52:05.520-06:00]my-script|INFO> Hello, world!
[2015-10-30T21:52:05.520-06:00]my-script|ERROR> Oh noes, world!

Install

npm i log-a-log

DownloadsWeekly Downloads

34

Version

6.1.0

License

MIT

Unpacked Size

9.77 kB

Total Files

7

Last publish

Collaborators

  • avatar