Avoid logging import in config

This commit is contained in:
Joscha 2020-05-12 18:19:23 +00:00
parent 4f56c8f192
commit 072c6630bf
2 changed files with 12 additions and 3 deletions

View File

@ -14,7 +14,7 @@ from .ilias import (IliasAuthenticator, IliasCrawler, IliasDirectoryFilter,
IliasDownloader, IliasDownloadInfo, IliasDownloadStrategy,
KitShibbolethAuthenticator, download_modified_or_new)
from .location import Location
from .logging import PrettyLogger
from .logging import PrettyLogger, enable_logging
from .organizer import Organizer
from .tmp_dir import TmpDir
from .transform import TF, Transform, apply_transform
@ -45,6 +45,16 @@ class Pferd(Location):
self._tmp_dir = TmpDir(self.resolve(tmp_dir))
self._test_run = test_run
@staticmethod
def enable_logging() -> None:
"""
Enable and configure logging via the logging module.
"""
enable_logging()
@staticmethod
def _print_transformables(transformables: List[TF]) -> None:
LOGGER.info("")

View File

@ -2,7 +2,6 @@ import argparse
from pathlib import Path, PurePath
from PFERD import Pferd
from PFERD.logging import enable_logging
from PFERD.transform import (attempt, do, glob, keep, move, move_dir,
optionally, re_move, re_rename)
@ -72,8 +71,8 @@ def main() -> None:
parser.add_argument("synchronizers", nargs="*")
args = parser.parse_args()
enable_logging()
pferd = Pferd(Path(__file__).parent, test_run=args.test_run)
pferd.enable_logging()
if not args.synchronizers or "numerik" in args.synchronizers:
pferd.ilias_kit(