Redirect external logging to stderr in case of --json flag
Table of contents
Current implementation
Currently, when an adtffileplugin loads or logs something, it will be printed to stdout.
For example:
adtf_dattool --liststreams recording.adtfdat --json --plugin asc_flexray_exporter.adtffileplugin
Results in:
2024-02-06 14:39:53 [INFO]: Shutdown runtime. [runtime.cpp:1094(Destruct)]
2024-02-06 14:39:53 [INFO]: Shutdown runtime. [runtime.cpp:1094(Destruct)]
[
{
"reader": "adtfdat",
"streams": [
{
"stream": "my_stream",
"type": "adtf/calibtb/xcp_frames",
"processors": [
],
"item_count": 6001,
"first_timestamp": 1701714341137910624,
"last_timestamp": 1701714401137720077
}
]
}
]
Risks
Issue for scripting/parsing when using --json
Expected improvement
When --json flag is set, only the json output should be printed to stdout, non other information. All other information must be redirected to the second available channel (stderr).
Edited by Florian Roth