Open cdunklau opened 4 years ago
Some thoughts for the future myself to load the context faster. Currently the log message in case connect failed is the following:
16:39:45.195393 [D] SOCKET::SRT 0x1793EF27 ASYNC Connecting to srt://192.168.0.7:4200
16:39:48.288862 [D] SOCKET::SRT 0x1793EF27 connect ERROR connection failed, socket state 6
16:39:48.294114 [D] SOCKET::SRT 0x1793EF27 Closing. Releasing epolls
16:39:48.295424 [D] SOCKET::SRT 0x1793EF27 Closing
spdlog library is used for logging functionality. One way to go is to try to use spdlog's custom formatting. Still, the message body itself will not be formatted this way. Example message body:
connect ERROR connection failed, socket state 6
The requested message should be:
{
"event": "CONNECT_FAILED",
"detail": {"reason": "timeout", "sockstate": 6},
"timestamp": "16:39:48.288862"
}
Looks like a custom wrapper on top of SPD log is needed to handle this kind of output if json mode is enabled. 🤔
Or add additional logger to exception handlers to write json formatted output in case of an error. Then successfull events should be somehow handled as well.
I filed a similar request against SRT with a lot more detail: Haivision/srt#1122
It's probably worthwhile to use a similar format.
It would be nice if
generate
andreceive
had an option that would make them output events in a structured format, so another program could tell what's going on. The most useful events I can think of are:Newline-delimited JSON is probably the nicest to consume, perhaps with a structure like: