pino
pino copied to clipboard
Sorting order of key in log object
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
I don't think it's possible at the moment. I would recommend to not read them manually but use pretty-print.
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.