GNOME Bugzilla – Bug 642452
g_parse_debug_string(): support “all except these flags”
Last modified: 2011-10-25 00:39:06 UTC
Today I found myself wanting to be able to set WOCKY_DEBUG="all -tls" to get all debugging output from Wocky, except for the TLS debugging output. Here's a branch improving the test coverage of g_parse_debug_string() slightly, then adding this feature: http://git.collabora.co.uk/?p=user/wjt/glib;a=shortlog;h=refs/heads/debug-strings
Created attachment 180987 [details] [review] Test g_parse_debug_string ("all")
Created attachment 180988 [details] [review] Test g_parse_debug_string with hyphens.
Created attachment 180989 [details] [review] g_parse_debug_string(): support subtracting from "all"
Review of attachment 180989 [details] [review]: I guess the idea is ok in principle, now that we have 'all'. I don't really like the extra decoration with the prepended '-', in particular since we allow '-' inside key names as well. Would you be open to just interpreting the presence of 'all' as meaning 'invert the remaining flags' ? Then 'all:foo:bar' could be used to indicate 'all except for foo and bar'
That could work. Alternative patch coming up. It's a little bit surprising that DEBUG="foo all" and DEBUG="all foo" mean two different things, but I doubt anyone will ever notice. Alternatively some other prefix could be used, maybe ‘~’ or ‘!’? (If only ‘¬’ was in ASCII I'd suggest using that, particularly since it's a key on the GB keyboard … ☺)
Created attachment 187305 [details] [review] g_parse_debug_string: invert flags after "all" Any flags specified after "all" are subtracted from the result, allowing the user to specify FOO_DEBUG="all,bar,baz" to mean "give me debugging information for everything except bar and baz".
I actually didn't envision this to be positional at all. I thought all,foo would give you the same as foo,all: all options except for foo
Created attachment 199536 [details] [review] g_parse_debug_string: invert flags given besides "all" Any flags specified as well as "all" are subtracted from the result, allowing the user to specify FOO_DEBUG="all,bar,baz" to mean "give me debugging information for everything except bar and baz".
Thanks, committed with a slight fixup for the testcase.