46 lines
1.1 KiB
Python
46 lines
1.1 KiB
Python
|
#!/usr/bin/env pyton3
|
||
|
import logging
|
||
|
import sys
|
||
|
|
||
|
import sentry_sdk
|
||
|
from sentry_sdk.integrations.logging import LoggingIntegration
|
||
|
|
||
|
from config import Config
|
||
|
from apscheduler.schedulers.blocking import BlockingScheduler
|
||
|
|
||
|
|
||
|
def run():
|
||
|
logging.info("Csirip")
|
||
|
|
||
|
|
||
|
def main():
|
||
|
sentry_logging = LoggingIntegration(
|
||
|
level=logging.INFO,
|
||
|
event_level=logging.ERROR
|
||
|
)
|
||
|
|
||
|
if Config.SENTRY_DSN:
|
||
|
sentry_sdk.init(
|
||
|
dsn=Config.SENTRY_DSN,
|
||
|
integrations=[sentry_logging],
|
||
|
traces_sample_rate=0.0,
|
||
|
send_default_pii=True,
|
||
|
release=Config.RELEASE_ID,
|
||
|
environment=Config.RELEASEMODE,
|
||
|
_experiments={"auto_enabling_integrations": True}
|
||
|
)
|
||
|
|
||
|
logging.basicConfig(
|
||
|
stream=sys.stdout,
|
||
|
format="%(asctime)s - %(name)s [%(levelname)s]: %(message)s",
|
||
|
level=logging.DEBUG if Config.DEBUG else logging.INFO
|
||
|
)
|
||
|
|
||
|
scheduler = BlockingScheduler()
|
||
|
scheduler.add_job(run, trigger='interval', seconds=Config.INTERVAL)
|
||
|
scheduler.start()
|
||
|
|
||
|
|
||
|
if __name__ == '__main__':
|
||
|
main()
|