Skip to content

Commit

Permalink
Merge 2a088af into e1e74aa
Browse files Browse the repository at this point in the history
  • Loading branch information
bbelyeu committed Jan 16, 2019
2 parents e1e74aa + 2a088af commit 4ec60ea
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README.md
Expand Up @@ -34,6 +34,9 @@ You can set the default logging level on your app with the config value `LOG_LEV
If you use Sentry with your project, you can setup [Sentry](https://sentry.io) logging by adding
the `SENTRY_DSN` configuration value. Your DSN can be retrieved from your project in Sentry.

If you do use Sentry, you may also want to specify an `ENV` (dev, staging, qa, prod, etc) in your
app's config so that the correct environment information can be sent to Sentry.

You can modify the console output format with the configuration values `LOG_FORMAT_CONSOLE` and
`LOG_FORMAT_TIME`. See the Python 3
[logging Formatter docs](https://docs.python.org/3/library/logging.html#logging.Formatter)
Expand Down
3 changes: 2 additions & 1 deletion flask_logger/extension.py
Expand Up @@ -57,7 +57,8 @@ def _setup_sentry(self, logger, dsn):
raise Exception('If specifying SENTRY_DSN, sentry_sdk must be installed'
' (pip install flask-logger[Sentry])')

sentry_init(dsn=dsn, integrations=[FlaskIntegration()])
env = self.config.get('environment') or self.config.get('env')
sentry_init(dsn=dsn, integrations=[FlaskIntegration()], environment=env)
sentry_integration = GLOBAL_HUB.get_integration(LoggingIntegration)
logger.addHandler(sentry_integration._handler) # pylint: disable=protected-access

Expand Down

0 comments on commit 4ec60ea

Please sign in to comment.