Add errbit integration

This commit is contained in:
Tom Naessens 2015-06-09 16:47:11 +02:00
parent dd4754ec0d
commit c77f9150db
3 changed files with 38 additions and 8 deletions

View file

@ -4,6 +4,8 @@ from flask import Flask
from flask.ext.bootstrap import Bootstrap, StaticCDN
from flask.ext.sqlalchemy import SQLAlchemy
from airbrake import Airbrake, AirbrakeHandler
app = Flask(__name__)
app.config.from_object('config.Configuration')
@ -29,9 +31,28 @@ class PrefixFix(object):
if not app.debug:
app.wsgi_app = PrefixFix(app.wsgi_app, '/haldis')
timedFileHandler = TimedRotatingFileHandler(app.config['LOGFILE'], when='midnight', backupCount=100)
timedFileHandler.setLevel(logging.DEBUG)
logger = logging.getLogger('werkzeug')
logger.setLevel(logging.DEBUG)
logger.addHandler(timedFileHandler)
loglogger = logging.getLogger('werkzeug')
loglogger.setLevel(logging.DEBUG)
loglogger.addHandler(timedFileHandler)
app.logger.addHandler(timedFileHandler)
airbrakelogger = logging.getLogger('airbrake')
# Airbrake
airbrake = Airbrake(
project_id=app.config['AIRBRAKE_ID'],
api_key=app.config['AIRBRAKE_KEY']
)
# ugly hack to make this work for out errbit
airbrake._api_url = "http://zeus-errbit.ilion.me/api/v3/projects/{}/notices".format(airbrake.project_id)
airbrakelogger.addHandler(
AirbrakeHandler(airbrake=airbrake)
)
app.logger.addHandler(
AirbrakeHandler(airbrake=airbrake)
)

View file

@ -8,3 +8,5 @@ class Configuration(object):
LOGFILE = 'haldis.log'
ZEUS_KEY = ''
ZEUS_SECRET = ''
AIRBRAKE_ID = ''
AIRBRAKE_KEY = ''

View file

@ -2,16 +2,23 @@ Flask==0.10.1
Flask-Admin==1.1.0
Flask-Bootstrap==3.3.4.1
Flask-Login==0.2.11
Flask-Migrate==1.4.0
Flask-OAuthlib==0.9.1
Flask-SQLAlchemy==2.0
Flask-Script==2.0.5
Flask-WTF==0.11
Flask-Migrate==1.4.0
itsdangerous==0.24
Jinja2==2.7.3
Mako==1.0.1
MarkupSafe==0.23
oauthlib==0.7.2
PyMySQL==0.6.6
requests==2.7.0
SQLAlchemy==1.0.4
Werkzeug==0.10.4
WTForms==2.0.2
Werkzeug==0.10.4
airbrake==1.1.4
alembic==0.7.6
blinker==1.3
itsdangerous==0.24
oauthlib==0.7.2
requests==2.7.0
requests-oauthlib==0.5.0
six==1.9.0