Next.js Discord

Discord Forum

logging a total request time

Unanswered
Mini Rex posted this in #help-forum
Open in Discord
Mini RexOP
is there something like life circle , or event to accomplish this task? so I don't need to code in every request function

4 Replies

if you want something like interceptor like
log()
do_command()
log()

you can use HOF( hight order function ) , which is a func that receives a func as an argument.
@tafutada777 if you want something like interceptor like log() do_command() log() you can use HOF( hight order function ) , which is a func that receives a func as an argument.
Mini RexOP
in this way, I still need to do some extra code. is there any request end life circle event I could only write logging code for one time?
javascript doesn’t support like ruby monkey patch, rust macro or c# extension luckily