Skip to content

Instantly share code, notes, and snippets.

@SEJeff
Created June 17, 2013 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SEJeff/5797176 to your computer and use it in GitHub Desktop.
Save SEJeff/5797176 to your computer and use it in GitHub Desktop.
import logging
from raven import Client
client = Client()
with level(logging.INFO):
client.captureMessage("Yo info")
with level(logging.DEBUG):
client.captureMessage("Debug log")
client.captureMessage("Error level here")
class level(object):
def __init__(self, level):
self.level = level
def __enter__(self):
self._old_level = logging.ERROR
logging.ERROR = self.level
def __exit__(self, type, value, traceback):
logging.ERROR = self._old_level
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment