tslog
tslog copied to clipboard
v4: Display defaultLogObj (ex: requestId)
I successively followed the RequestId section in the readme.
I have now a requestId field in my logObj.
But if I try to overwrite formatLogObj to display the requestId in the console, I can't find the field/value.
Am i doing something wrong, is it not supported yet ?
Or in other words, how to display requestId in the log.
I thought of having the default log as quiet and let a new transport do all the work but it seems a little overkill.
Edit: I finally succeed with
overwrite: {
toLogObj(args, clonesLogObj) {
const fullLogObj = { ...args, ...(clonesLogObj as ILogObjReqId)}
args.unshift(clonesLogObj?.requestId)
return fullLogObj },
But it mutate args wich I don't really like.
If someone has a better idea