How to use the bugsnag.configure function in bugsnag

To help you get started, we’ve selected a few bugsnag examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bugsnag / bugsnag-python / tests / test_handlers.py View on Github external
def setUp(self):
        super(HandlersTest, self).setUp()
        bugsnag.configure(use_ssl=False,
                          endpoint=self.server.address,
                          api_key='tomatoes',
                          notify_release_stages=['dev'],
                          release_stage='dev',
                          asynchronous=False)
        bugsnag.logger.setLevel(logging.INFO)
github armadillica / dillo / dillo / application / __init__.py View on Github external
registry.register('https?://p3d.in/*',
    Provider('https://p3d.in/oembed'))
registry.register('https?://vine.co/v/*',
    Provider('https://vine.co/oembed.json'))
registry.register('https?://instagram.com/p/*',
    Provider('http://api.instagram.com/oembed'))

if app.config.get('CACHE_REDIS_HOST') and app.config['CACHE_TYPE'] == 'redis':
    redis_client = redis.StrictRedis(
        host=app.config['CACHE_REDIS_HOST'],
        port=app.config['CACHE_REDIS_PORT'])
else:
    redis_client = None

if app.config.get('BUGSNAG_KEY'):
    bugsnag.configure(
      api_key = app.config['BUGSNAG_KEY'],
      project_root = app.config['BUGSNAG_APP_PATH']
    )
    handle_exceptions(app)

# Config at https://console.developers.google.com/
if app.config.get('SOCIAL_GOOGLE'):
    google = oauth.remote_app(
        'google',
        consumer_key=app.config.get('SOCIAL_GOOGLE')['consumer_key'],
        consumer_secret=app.config.get('SOCIAL_GOOGLE')['consumer_secret'],
        request_token_params={
            'scope': 'https://www.googleapis.com/auth/userinfo.email'
        },
        base_url='https://www.googleapis.com/oauth2/v1/',
        request_token_url=None,
github bugsnag / bugsnag-python / example / bottle / server.py View on Github external
from bottle import route, run, app, static_file
import bugsnag

from bugsnag.wsgi.middleware import BugsnagMiddleware

bugsnag.configure(
    api_key='some-api-key',
)


@route('/')
def index():
    return static_file('index.html', root='.')


@route('/crash')
def crash():
    """Deliberately raises an unhandled error and crash the app.
    """
    raise Exception('SomethingBad')
github armadillica / flamenco / flamenco / server-eve / application / __init__.py View on Github external
try:
    git_cmd = ['git', '-C', app_root, 'describe', '--always']
    description = subprocess.check_output(git_cmd)
    app.config['GIT_REVISION'] = description.strip()
except (subprocess.CalledProcessError, OSError) as ex:
    log.warning('Unable to run "git describe" to get git revision: %s', ex)
    app.config['GIT_REVISION'] = 'unknown'
log.info('Git revision %r', app.config['GIT_REVISION'])

# Configure Bugsnag
if not app.config.get('TESTING') and app.config.get('BUGSNAG_API_KEY'):
    import bugsnag
    import bugsnag.flask
    import bugsnag.handlers

    bugsnag.configure(
        api_key=app.config['BUGSNAG_API_KEY'],
        project_root="/data/git/pillar/pillar",
        revision=app.config['GIT_REVISION'],
    )
    bugsnag.flask.handle_exceptions(app)

    bs_handler = bugsnag.handlers.BugsnagHandler()
    bs_handler.setLevel(logging.ERROR)
    log.addHandler(bs_handler)
else:
    log.info('Bugsnag NOT configured.')

# Google Cloud project
try:
    os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = \
        app.config['GCLOUD_APP_CREDENTIALS']
github Antergos / Cnchi / cnchi.tmp / cnchi / cnchi.py View on Github external
if cmd_line.verbose:
        # Show log messages to stdout
        stream_handler = logging.StreamHandler()
        stream_handler.setLevel(log_level)
        stream_handler.setFormatter(formatter)
        logger.addHandler(stream_handler)

    if cmd_line.log_server:
        log_server = cmd_line.log_server

        if log_server == 'bugsnag':
            if not BUGSNAG_ERROR:
                # Bugsnag logger
                bugsnag_api = context_filter.api_key
                if bugsnag_api is not None:
                    bugsnag.configure(
                        api_key=bugsnag_api,
                        app_version=info.CNCHI_VERSION,
                        project_root='/usr/share/cnchi/cnchi',
                        release_stage=info.CNCHI_RELEASE_STAGE)
                    bugsnag_handler = BugsnagHandler(api_key=bugsnag_api)
                    bugsnag_handler.setLevel(logging.WARNING)
                    bugsnag_handler.setFormatter(formatter)
                    bugsnag_handler.addFilter(context_filter.filter)
                    bugsnag.before_notify(context_filter.bugsnag_before_notify_callback)
                    logger.addHandler(bugsnag_handler)
                    logging.info(
                        "Sending Cnchi log messages to bugsnag server (using python-bugsnag).")
                else:
                    logging.warning(
                        "Cannot read the bugsnag api key, logging to bugsnag is not possible.")
            else:
github tchoedak / anoti / anoti / config.py View on Github external
import os
from datetime import timedelta
import bugsnag


# setup bugsnag logging
bugsnag.configure(
    api_key=os.environ.get('BUGSNAG_API_KEY'),
    project_root=os.path.abspath(os.path.dirname(__file__)),
)

# Amazon API configuration
endpoint = 'Orders'
seller_id = os.environ.get('SELLER_ID')
service = "https://mws.amazonservices.com"
marketplace_id = 'ATVPDKIKX0DER'  # US market
country_code = 'US'
request_per_hour_quota = 200
access_key = os.environ.get('SELLER_CENTRAL_ACCESS_KEY_ID')
secret_key = os.environ.get('SELLER_CENTRAL_SECRET_KEY')
app = 'anoti'
mws_auth_token = os.environ.get('MWS_AUTH_TOKEN')
github docker / docker-registry / docker_registry / extras / ebugsnag.py View on Github external
def boot(application, api_key, flavor, version):
    # Configure bugsnag
    if api_key:
        try:
            import bugsnag
            import bugsnag.flask

            root_path = os.path.abspath(
                os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
            bugsnag.configure(api_key=api_key,
                              project_root=root_path,
                              release_stage=flavor,
                              notify_release_stages=[flavor],
                              app_version=version
                              )
            bugsnag.flask.handle_exceptions(application)
        except Exception as e:
            raise Exception('Failed to init bugsnag agent %s' % e)
github bugsnag / bugsnag-python / bugsnag / tornado / __init__.py View on Github external
def prepare(self):
        bugsnag.configure().runtime_versions['tornado'] = tornado.version
        if bugsnag.configuration.auto_capture_sessions:
            bugsnag.start_session()
github Antergos / antbs / antbs / logging_config.py View on Github external
def _initialize(self):
        bugsnag.configure(api_key=self._bugsnag_key, project_root=self._app_dir)
        logging.config.dictConfig(self.get_logging_config())

        logger = logging.getLogger('antbs')

        for logger_name in self._noisy_loggers:
            _logger = logging.getLogger(logger_name)
            _logger.setLevel(logging.ERROR)

        bs_handler_found = [h for h in logger.handlers if isinstance(h, BugsnagHandler)]

        if not bs_handler_found:
            bugsnag_handler = BugsnagHandler()
            bugsnag_handler.setLevel(logging.WARNING)
            logger.addHandler(bugsnag_handler)

        self.logger = logger