bridgedb's logger should gather metrics/statistics automatically
While writing bridgedb's logger, I made a context manager for storing a state dictionary which is, so far rather loosely defined, but it would allow us to gather free statistics on bridgedb. Essentially, you would use it like so:
from bridgedb import log as logging
logging.callWithContext(myfoocontext, {'addBridgeAssignment': foobridge})
It is also safely threadable, so it would be possible to use this to retrieve debugging information from threads, for instance for #5232 (moved).
The nice thing about this is that it is easily called from the logger (and will still handles log levels and all the other added features from #9199 (moved)). The bad thing is that if it is not written very clearly, it could be difficult for other/new people reading the code to understand, especially if they are not familiar with Twisted.
Part of this was also discussed between myself and Karsten on tor-assistants@lists.tpo, earlier this month, in the "BridgeDB data for metrics" thread.