aniftyco / kubit

Full stack web framework for Node.js
https://kubitjs.com/
MIT License
25 stars 2 forks source link

Show request url in logs #24

Open dmdboi opened 6 months ago

dmdboi commented 6 months ago

Logger middleware for every incoming request. i.e

import type { HttpContextContract } from "@ioc:Adonis/Core/HttpContext";

import { default as Log } from "@ioc:Adonis/Core/Logger";

export default class Logger {
  public async handle(ctx: HttpContextContract, next: () => Promise<void>) {
    Log.info(`[ Req ] ${ctx.request.url()}`);
    await next();
  }
}
joshmanders commented 6 months ago

Is this a dev only feature or in production too? In production logs should be coming from your http server, but I can understand wanting them in dev (this is standard in most frameworks like express, etc)

dmdboi commented 6 months ago

Should be dev-only, although we could give the option to enable in production too