Logbook has a ContextObject which is used by various objects, most notably the Handler class. As a context manager, these objects will push either greenlet or thread context depending on whether "gevent" support is enabled. There are explicit contextmanagers, push, and pop methods for each variant:
application context is global and so still has a purpose.
contextvars is available in all the Python versions we support, and greenlet 1.0+ supports it natively, so we can get rid of the thread/greenlet variants.
I wonder if we can already deprecate them and make them use context underneath.
Logbook has a
ContextObject
which is used by various objects, most notably theHandler
class. As a context manager, these objects will push either greenlet or thread context depending on whether "gevent" support is enabled. There are explicit contextmanagers, push, and pop methods for each variant:applicationbound()
,push_application()
,pop_application()
threadbound()
,push_thread()
,pop_thread()
greenletbound()
,push_greenlet()
,pop_greenlet()
contextbound()
,push_context()
,pop_context()
application
context is global and so still has a purpose.contextvars
is available in all the Python versions we support, and greenlet 1.0+ supports it natively, so we can get rid of thethread
/greenlet
variants.I wonder if we can already deprecate them and make them use
context
underneath.