silly-logging-middleware

1.0.3 • Public • Published

silly-logging-middleware

A logging middleware for Express 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-middleware

Usage

const express = require('express')
const logger = require('silly-logging-middleware')

const app = express()

app.use(logger)

app.get('/', (req, res) => {
  return res.send('Hello World')
})

app.listen(3000)

Output

{"app":"none","environment":"none","timestamp":"2021-06-17T01:34:55.887Z","details":{"url": "/"},"statusCode":200,"statusMessage":"OK","duration":11}

Package Sidebar

Install

npm i silly-logging-middleware

Weekly Downloads

3

Version

1.0.3

License

ISC

Unpacked Size

3.6 kB

Total Files

5

Last publish

Collaborators

  • mlefebvr