Skip to content

Instantly share code, notes, and snippets.

@theacodes
Created October 7, 2014 20:30
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 theacodes/1b5046baf99c609e4e0d to your computer and use it in GitHub Desktop.
Save theacodes/1b5046baf99c609e4e0d to your computer and use it in GitHub Desktop.
Sentry/Raven simple global logging setup
from raven.handlers.logging import SentryHandler
from raven.conf import setup_logging
import logging
handler = SentryHandler('sentry dsn here')
setup_logging(handler)
console = logging.StreamHandler()
console.setLevel(logging.INFO)
formatter = logging.Formatter('%(asctime)-12s: %(levelname)-8s: %(message)s', datefmt='%m-%d %H:%M')
console.setFormatter(formatter)
logging.getLogger().addHandler(console)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment