CLI flag to log stdout messages as JSON
Jazcash opened this issue · 2 comments
This will make it easier for the lobby to parse info from prd. Ideally, each object would follow a standard format, such as:
[Info] /spring/tools/pr-downloader/src/pr-downloader.cpp:178:DownloadSetConfig():Free disk space: 172128 MB
->
{
"type": "info",
"message": "Free disk space: 172128 MB"
}
[Progress] 7% [== ] 6550225/90399836
->
{
"type": "download",
"content": "Beyond All Reason test-16314-fff9e7a",
"progress": {
"bytesDownloaded": 6550225,
"totalBytes": 90399836,
"percent": 0.07
}
}
There's also lot of guff in the current stdout that isn't useful for end users, would be preferable to hide that behind a --verbose
flag.
So, that's 2 feature requests:
- ask to select logging level dynamically (low prio, you can filter out in lobby imho)
- add option to log as JSON.
For logging as JSON, I have one problem that I've not figure out yet: internationalization of messages. Do we need to do that? Maybe the messages somehow should be more structured so that lobby can translate? Or we assume that all errors, including retry messages it's fine to present in English?
Fine for messages to be in english as it's only a CLI tool and nothing we expect players to use themselves. As for BAR Lobby, anything prd does will be parsed and presented to the end user in a nice way and raw messages won't ever be shown as-is.