forked from Hay1tsme/artemis
Centralized logging
Allows us to extend the logging infrastructure, e.g. by adding Loki/Discord webhooks to the mix.
This commit is contained in:
@ -1,10 +1,10 @@
|
||||
#!/usr/bin/env python3
|
||||
import argparse
|
||||
import logging
|
||||
from os import mkdir, path, access, W_OK
|
||||
import yaml
|
||||
import asyncio
|
||||
|
||||
import core.logger
|
||||
from core.data import Data
|
||||
from core.config import CoreConfig
|
||||
|
||||
@ -41,6 +41,7 @@ if __name__ == "__main__":
|
||||
exit(1)
|
||||
|
||||
data = Data(cfg)
|
||||
database_logger = core.logger.create_logger("Database", cfg, cfg.database.loglevel)
|
||||
|
||||
if args.action == "create":
|
||||
data.create_database()
|
||||
@ -50,7 +51,7 @@ if __name__ == "__main__":
|
||||
|
||||
elif args.action == "downgrade":
|
||||
if not args.version:
|
||||
logging.getLogger("database").error(f"Version argument required for downgrade")
|
||||
database_logger.error("Version argument required for downgrade")
|
||||
exit(1)
|
||||
data.schema_downgrade(args.version)
|
||||
|
||||
@ -71,4 +72,4 @@ if __name__ == "__main__":
|
||||
loop.run_until_complete(data.create_revision_auto(args.message))
|
||||
|
||||
else:
|
||||
logging.getLogger("database").info(f"Unknown action {args.action}")
|
||||
database_logger.info(f"Unknown action {args.action}")
|
||||
|
Reference in New Issue
Block a user