auto-archiver/src/auto_archiver/databases/console_db.py

32 wiersze
832 B
Python
Czysty Zwykły widok Historia

2023-01-21 19:01:02 +00:00
from loguru import logger
from . import Database
from ..core import Metadata
class ConsoleDb(Database):
"""
Outputs results to the console
"""
name = "console_db"
def __init__(self, config: dict) -> None:
# without this STEP.__init__ is not called
super().__init__(config)
@staticmethod
def configs() -> dict:
return {}
def started(self, item: Metadata) -> None:
logger.warning(f"STARTED {item}")
2024-02-29 11:40:30 +00:00
def failed(self, item: Metadata, reason:str) -> None:
logger.error(f"FAILED {item}: {reason}")
2023-01-21 19:01:02 +00:00
def aborted(self, item: Metadata) -> None:
logger.warning(f"ABORTED {item}")
def done(self, item: Metadata, cached: bool=False) -> None:
2023-01-21 19:01:02 +00:00
"""archival result ready - should be saved to DB"""
logger.success(f"DONE {item}")