some updates
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2021-08-10 16:15:20 +02:00
parent e6afdd5bac
commit c26aa1be43
2 changed files with 28 additions and 17 deletions

View File

@ -21,21 +21,6 @@ __copyright__ = "Copyright 2020, Birbnetes Team"
__module_name__ = "app"
__version__text__ = "1"
if config.SENTRY_DSN:
sentry_logging = LoggingIntegration(
level=logging.DEBUG, # Capture info and above as breadcrumbs
event_level=logging.ERROR # Send errors as events
)
sentry_sdk.init(
dsn=config.SENTRY_DSN,
send_default_pii=True,
integrations=[sentry_logging],
traces_sample_rate=1.0,
release=config.RELEASE_ID,
environment=config.RELEASEMODE,
_experiments={"auto_enabling_integrations": True}
)
def setup_rabbit(mqtt_: MQTT) -> None:
logging.info("Connecting to RabbitMQ...")
@ -118,15 +103,33 @@ def on_message_creator(mqtt_: MQTT):
return on_message
if __name__ == "__main__":
def main():
logging.basicConfig(
stream=sys.stdout,
format="%(asctime)s - %(name)s [%(levelname)s]: %(message)s",
level=logging.DEBUG if '--debug' in sys.argv else logging.INFO
level=config.LOG_LEVEL
)
if config.SENTRY_DSN:
sentry_logging = LoggingIntegration(
level=logging.DEBUG, # Capture info and above as breadcrumbs
event_level=logging.ERROR # Send errors as events
)
sentry_sdk.init(
dsn=config.SENTRY_DSN,
send_default_pii=True,
integrations=[sentry_logging],
traces_sample_rate=0.0,
release=config.RELEASE_ID,
environment=config.RELEASEMODE,
_experiments={"auto_enabling_integrations": True}
)
logging.info("Guard service starting...")
mqtt = MQTT()
mqtt.topic = config.MQTT_TOPIC
mqtt.connect()
mqtt.client.loop_start() # Start MQTT event loop on a different thread
setup_rabbit(mqtt)
if __name__ == "__main__":
main()