To be fair, the situation of sorting log entries and then running one out a different path from the other probably could have been better handled by somehow making a different category, perhaps. I’ve brought it up with the developer this morning to see if we can get away from doing this check / relaying information this way through the logging system.
As for features that drove us to this path, I’m not sure what part of what I did would be worth a PR, so I’ll try to explain how I arrived at this solution.
I could not find a way to provide alternate formatters for the object
that is passed into the various log entries so that rather than just printing the object name and pointer address we could put some extra information there, because the function that performs the operation in gstreamer is also private to that object file (along with all the code that formats color into the message, if enabled, etc.). Initially all we wanted was the ability to tune how object
is handled and ended up having to copy the default log handler, various functions and structures it depends against, etc. into our own logging implementation.
Our application results in multiple large hierarchies and being able to associate elements that we do not “own” (i.e., they’re from GStreamer plugins) with the hierarchy established by our own GstBins. When it is under heavy use, trying to eye-grep a log during an issue is next to impossible since all of the hierarchies of logs would be mixed together. The solution I came up with was to both tag elements (that we do not “own”) with GObject data, and, for our own elements, use an glib interface to help associate a generic element’s log message with our application’s logical hierarchy. Our log handler tries to walk up the object
argument and create a colon-separated prefix of that hierarchy so that we get the default log information followed by our IDs:
date time location, etc. ... GRAND:PARENT:CHILD original log formatted message
If we had the ability to extend how object
is handled, specifically, the result would have been our prefixes get inserted by the default log handler and at least initially we would have been “done” with that feature.
The second feature was formatting the log output to print JSON blobs, but that did not require any additional copy/paste things but did make use of the object crawler so that when we dump the blob, we have GRAND: <id>, ...
for example. Our log aggregator then makes it easy to give columns using keys+values from JSON blob, so if we want only logs for a specific GRAND (and its hierarchy), we can trivially get that as well as a formatted table showing the logged message and its place in the hierarchy.
I’m not sure who else might care to have either of those features.