npm.io
0.1.6 • Published 3 years ago

lowtide

Licence
MIT
Version
0.1.6
Deps
0
Size
3 kB
Vulns
0
Weekly
0
Stars
2

Lowtide

NodeJS file logger.

Features:

  • Extremely minimal and fast, no dependencies
  • Logs to file asynchronously
  • Supports formatted logging of arrays, objects and dates
  • Can be used to log to file with console.log and console.error in production

Install

npm i lowtide

Usage

// Require
const lowtide = require('lowtide')

// Init logger on this file
const log = lowtide('file.log')

// Log string
log('Something happened!')

// Log object
log({ name: 'something' })

// Log console log and error to file
if (process.env.NODE_ENV == 'production') {
  console.log = lowtide('log/app.log')
  console.error = lowtide('log/err.log')
}

MIT Licensed. Enjoy!