/jsout-express

Simple express request logger middleware for jsout.

Primary LanguageJavaScript

jsout-express

build status SemVer Conventional Commits

Simple express request logger middleware for jsout.

Log example

{
  "level": 6,
  "message": "req",
  "data": {
    "method": "GET",
    "url": "/",
    "hostname": "localhost",
    "ip": "::ffff:127.0.0.1",
    "statusCode": 200,
    "statusMessage": "OK",
    "durationMs": 3.2342
  }
}

Installation

npm i jsout jsout-express

Usage

Include it like you would any other middleware, but it should be first (or towards the top) to be accurate. At the very least, it must be before any other handler that might send a response.

import {express} from 'express';
import {logger} from 'jsout';
import {logRequest} from 'jsout-express';

const app = express();

// should be first, before other middlewares
app.use(logRequest);

// ... other things ...

app.listen();

Support, Feedback, and Contributions

  • Star this repo if you like it!
  • Submit an issue with your problem, feature request or bug report
  • Issue a PR against main and request review. Make sure all tests pass and coverage is good.
  • Write about jsout and jsout-express in your blog, tweet about it, or share it with your friends!

Together we can make software more reliable and easier to maintain!

Sponsors

Logo

Aeroview is a developer-friendly, AI-powered observability platform that helps you monitor, troubleshoot, and optimize your applications. Get started for free at https://aeroview.io.