1.0.0 • Published 3 years ago

silly-logging-function v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

silly-logging-function

A logging function so simple it's silly

Best used with apps that log to the console, for example when inside a Docker container.

While testing, if NODE_ENV is set to 'test', no log message will be generated.

The following environment variables will be added to the log:

  • NODE_ENV as 'environment'
  • APP as 'app'

Installation

$ npm install silly-logging-function

Usage

const logger = require('silly-logging-function')

const myFunction = (arg) => {
  logger({
    arg,
    message: `Received log message ${arg}`
  })
}

myFunction('test')

Output

{"timestamp":"2021-06-19T04:01:04.186Z","details":{"arg":"test","message":"Received log message test"}}