Skip to content

Instantly share code, notes, and snippets.

@mbr
Last active August 29, 2015 14:19
Show Gist options
  • Save mbr/6afa28c8b9f0b71d4cf4 to your computer and use it in GitHub Desktop.
Save mbr/6afa28c8b9f0b71d4cf4 to your computer and use it in GitHub Desktop.
Example taken from the logbook docs, not working as of 0.9.0.
# from https://pythonhosted.org/Logbook/api/handlers.html#logbook.Handler
#
# > By default messages sent to that handler will not go to a handler on an
# > outer level on the stack, if handled. This can be changed by setting
# > bubbling to True. This setup for example would not have any effect:
# >
# > handler = NullHandler(bubble=True)
# > handler.push_application()
# >
# > Whereas this setup disables all logging for the application:
# >
# > handler = NullHandler()
# > handler.push_application()
#
# The small script below tries to recreate the example minimally as accurate
# as possible:
from logbook import NullHandler, critical
handler = NullHandler(bubble=True)
handler.push_application()
critical('sample message, should bubble')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment