tristanisham / logysia

Logysia is a logging library for the Elysia Web Framework for Bun (JS/TS).
MIT License
36 stars 9 forks source link

Custom non-200 statuses #15

Open peterbe opened 7 months ago

peterbe commented 7 months ago

I have an app that looks like this:

 .get("/*", ({ params, set }) => {
    if (Math.random() > 0.9) {
      set.status = 403;
      return "You have exceeded a secondary rate limit";
    }
    return { items: [] };
  })

And when you hit it repeatedly, all the logging says is

...
GET /any/thing | 22µs
GET /any/thing | 21µs
GET /any/thing | 21µs
GET /any/thing | 22µs
GET /any/thing | 21µs
GET /any/thing | 21µs
GET /any/thing | 22µs
GET /any/thing | 22µs
GET /any/thing | 25µs
...

I guess, by default the logging string is about the request | about the response and in the about the response, the only thing is displays is the time it took (e.g. 21µs). Could the default mention non-200 exit codes too?