def init_app(self, app): wp_application_name = app.config.get("APPLICATION_NAME") env_name = get_env().lower() app_name = "%s/%s:%s" % (wp_application_name, self._app_name, env_name) settings.app_name = app_name settings.license_key = app.config.get("NEWRELIC_LICENSE_KEY")
'handlers': ['rollbar'], 'level': 'WARN', }, } } """ import os from juice import get_env, init_app import rollbar import rollbar.contrib.flask from flask import got_request_exception, request import logging import logging.handlers _env = get_env().lower() class RollbarLogger(logging.Handler): def __init__(self, access_token, *args, **kwargs): logging.Handler.__init__(self, *args, **kwargs) rollbar.init( # access token for the demo app: https://rollbar.com/demo access_token, # environment name _env, # server root directory, makes tracebacks prettier root=os.path.dirname(os.path.realpath(__file__)),