Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v4: Display defaultLogObj (ex: requestId) #231

Open
poluxus opened this issue May 3, 2023 · 0 comments
Open

v4: Display defaultLogObj (ex: requestId) #231

poluxus opened this issue May 3, 2023 · 0 comments

Comments

@poluxus
Copy link

poluxus commented May 3, 2023

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

@poluxus poluxus changed the title v4: Display requestId v4: Display defaultLogObj (ex: requestId) May 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant