mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 20:16:44 +00:00
Add option for sentry.io integration
This commit is contained in:
parent
873c03376a
commit
b1d33ef3bc
@ -72,6 +72,27 @@ if DEBUG:
|
|||||||
format='%(asctime)s %(levelname)s %(message)s',
|
format='%(asctime)s %(levelname)s %(message)s',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Does the user wish to use the sentry.io integration?
|
||||||
|
sentry_opts = CONFIG.get('sentry', {})
|
||||||
|
|
||||||
|
if sentry_opts.get('enabled', False):
|
||||||
|
dsn = sentry_opts.get('dsn', None)
|
||||||
|
|
||||||
|
if dsn is not None:
|
||||||
|
# Try to import required modules (exit if not installed)
|
||||||
|
try:
|
||||||
|
import sentry_sdk
|
||||||
|
from sentry_sdk.integrations.django import DjangoIntegration
|
||||||
|
|
||||||
|
sentry_sdk.init(dsn=dsn, integrations=[DjangoIntegration()], send_default_pii=True)
|
||||||
|
|
||||||
|
except ModuleNotFoundError:
|
||||||
|
print("sentry_sdk module not found. Install using 'pip install sentry-sdk'")
|
||||||
|
sys.exit(-1)
|
||||||
|
|
||||||
|
else:
|
||||||
|
print("Warning: Sentry.io DSN not specified")
|
||||||
|
|
||||||
# Application definition
|
# Application definition
|
||||||
|
|
||||||
INSTALLED_APPS = [
|
INSTALLED_APPS = [
|
||||||
|
@ -66,3 +66,10 @@ log_queries: False
|
|||||||
# Set the backup_dir parameter to store backup files in a specific location
|
# Set the backup_dir parameter to store backup files in a specific location
|
||||||
# If unspecified, the local user's temp directory will be used
|
# If unspecified, the local user's temp directory will be used
|
||||||
#backup_dir: '/home/inventree/backup/'
|
#backup_dir: '/home/inventree/backup/'
|
||||||
|
|
||||||
|
# Sentry.io integration
|
||||||
|
# If you have a sentry.io account, it can be used to log server errors
|
||||||
|
# Ensure sentry_sdk is installed by running 'pip install sentry-sdk'
|
||||||
|
sentry:
|
||||||
|
enabled: False
|
||||||
|
# dsn: add-your-sentry-dsn-here
|
||||||
|
Loading…
x
Reference in New Issue
Block a user