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

Sorting order of key in log object #1504

Closed
schealex opened this issue Jul 23, 2022 · 2 comments
Closed

Sorting order of key in log object #1504

schealex opened this issue Jul 23, 2022 · 2 comments

Comments

@schealex
Copy link

Hi there,

maybe this is a really dumb question but we have thease logs right now:

{"level":"info","pid":32064,"hostname":"ascherer-pc","appName":"@triluxds/tds-lp-nest-logger","appVersion":"0.0.1","context":"InstanceLoader","payload":{ "test": "test123" },"msg":"LoggerTestModule dependencies initialized"}
{"level":"info","pid":32064,"hostname":"ascherer-pc","appName":"@triluxds/tds-lp-nest-logger","appVersion":"0.0.1","context":"RoutesResolver","payload":{ "test": "dfgdfgdfgdfgdfgdfg" },"msg":"LoggerTestController {/}:"}
{"level":"info","pid":32064,"hostname":"ascherer-pc","appName":"@triluxds/tds-lp-nest-logger","appVersion":"0.0.1","context":"RouterExplorer","payload":{ "test": "456456456456456456456456456456" },"msg":"Mapped {/, GET} route"}
{"level":"info","pid":32064,"hostname":"ascherer-pc","appName":"@triluxds/tds-lp-nest-logger","appVersion":"0.0.1","context":"RouterExplorer","payload":{ "test": "dfghdfghdfghdfghdfghdfghdfghdfgh" },"msg":"Mapped {/forbidden, GET} route"}

i would like to have the payload at the end as it can have various contents and the msg right after appVersion which would make all msg be in line for easier reading. Is that possible at all?

the ouput we would like to have:

{"level":"info","pid":32064,"hostname":"ascherer-pc","appName":"@triluxds/tds-lp-nest-logger","appVersion":"0.0.1","msg":"LoggerTestModule dependencies initialized","context":"InstanceLoader","payload":{ "test": "test123" }}
{"level":"info","pid":32064,"hostname":"ascherer-pc","appName":"@triluxds/tds-lp-nest-logger","appVersion":"0.0.1","msg":"LoggerTestController {/}:","context":"RoutesResolver","payload":{ "test": "dfgdfgdfgdfgdfgdfg" }}
{"level":"info","pid":32064,"hostname":"ascherer-pc","appName":"@triluxds/tds-lp-nest-logger","appVersion":"0.0.1","msg":"Mapped {/, GET} route","context":"RouterExplorer","payload":{ "test": "456456456456456456456456456456" }}
{"level":"info","pid":32064,"hostname":"ascherer-pc","appName":"@triluxds/tds-lp-nest-logger","appVersion":"0.0.1","msg":"Mapped {/forbidden, GET} route","context":"RouterExplorer","payload":{ "test": "dfghdfghdfghdfghdfghdfghdfghdfgh" }}

I've tried to use the log formatter to change to order but that did nothing.

Any help appreciated!

Regards
Alex

@mcollina
Copy link
Member

I don't think it's possible at the moment. I would recommend to not read them manually but use pretty-print.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants