Add colorful log output

Highlight the important operations (new, modified) in different colours.
This commit is contained in:
I-Al-Istannen
2019-06-07 13:26:23 +02:00
parent da602366f8
commit 67da4e69fa
7 changed files with 48 additions and 12 deletions

View File

@ -4,13 +4,13 @@ import logging
import pathlib
import re
import bs4
from .ilias_authenticators import ShibbolethAuthenticator
from .organizer import Organizer
from .utils import PrettyLogger
__all__ = ["Ilias"]
logger = logging.getLogger(__name__)
pretty = PrettyLogger(logger)
class Ilias:
FILE_RE = re.compile(r"goto\.php\?target=(file_\d+_download)")
@ -22,7 +22,7 @@ class Ilias:
self._auth = ShibbolethAuthenticator(base_path / cookie_file)
def synchronize(self, ref_id, to_dir, transform=lambda x: x, filter=lambda x: True):
logger.info(f" Synchronizing ref_id {ref_id} to {to_dir} using the Ilias synchronizer.")
pretty.starting_synchronizer(to_dir, "ILIAS", f"ref_id {ref_id}")
sync_path = pathlib.Path(self.base_path, to_dir)
orga = Organizer(self.base_path, sync_path)