v5: http logger #1500
-
Hi! I was previously using adonis-http-logger on my v4 application, and since the package hasn't been migrated yet, I want to implement it myself on my Adonis v5 API. However, I don't know what could be the equivalent of the following in Adonis v5 HttpContext.onReady(function (ctx) {
const logger = new Logger(ctx, AdonisLogger)
logger.hook()
}) Can someone help me figure this out? :) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
I think you can add a .ts file inside /start and preload it inside .adonisrc.json
Don't know if you can pass ctx inside preloads files |
Beta Was this translation helpful? Give feedback.
-
I don't know if it's best practice or not, but you could implement a server-level middleware that performs logging "downstream" of the request (after the next()). |
Beta Was this translation helpful? Give feedback.
I think you can add a .ts file inside /start and preload it inside .adonisrc.json
Don't know if you can pass ctx inside preloads files