trae middleware to emit events on before, after and finally states
trae middleware to log requests & responses