Skip to content

Commit

Permalink
Send log warnings to Sentry
Browse files Browse the repository at this point in the history
  • Loading branch information
YtvwlD committed Feb 20, 2024
1 parent a8aaac6 commit 5c54f4d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,16 @@ def publish_to_mqtt(self) -> None:
logger.info("Configuring Sentry...")
import sentry_sdk
from sentry_sdk.integrations.logging import LoggingIntegration
sentry_logging = LoggingIntegration(
level=logging.INFO, # Capture as breadcrumbs
event_level=logging.WARNING, # Send as events
)
sentry_sdk.init(
DSN_PATH.read_text().strip(),
debug=True,
attach_stacktrace=True,
integrations=[
LoggingIntegration(
level=logging.INFO, # Capture as breadcrumbs
event_level=logging.WARNING, # Send as events
),
],
)

config = toml.load(environ.get("CONFIG_FILE", "siamqtt.toml"))
Expand Down

0 comments on commit 5c54f4d

Please sign in to comment.