For what it’s worth, I’ve implemented in several of my own projects a low-key tracing facility which for Spice would basically look like this: Specifically: - Define available traces in spice-traces.def file, e.g.: // SPICE_TRACE(name, default_value, info) SPICE_TRACE(foo, false, “Talk about foo") SPICE_TRACE(bar, true, “A bar is a good thing, enabled by default") #undef SPICE_TRACE - Declare a structure holding one bit per trace flag, as follows: extern struct spice_traces { #define SPICE_TRACE(name, init, info) bool name:1; #include “spice-traces.def” } spice_traces; struct spice_traces spice_traces = { #define SPICE_TRACE(name, init, info) init, #include “spice-traces.def" }; - In log.c, add a function to deal with passing trace options either from command-line or environemnt - In log.h, add macros to quickly test traces: #define TRACE(name) (spice_traces.name) #define IFTRACE(name) if (TRACE(name)) #define spice_trace(name, …) IFTRACE(name) spice_debug(__VA_ARGS__) - In spice-option.c, add code to deal with testing the options. Would you find this useful? The most difficult part being to connect that to existing tracing mechanisms to avoid replication of traces, while at the same time ensuring that the existing enabling mechanisms work as before. Christophe
|
_______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel