From ef4789b246d3ea9e7f4b163b00731a7bd055d71c Mon Sep 17 00:00:00 2001 From: Kevin Midboe Date: Sun, 4 Jul 2021 15:23:03 +0200 Subject: [PATCH] Moved logger setup to __init__ file. --- torrentSearch/__init__.py | 13 ++++++++++++- torrentSearch/__main__.py | 9 +-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/torrentSearch/__init__.py b/torrentSearch/__init__.py index 26fb39c..6e3755c 100644 --- a/torrentSearch/__init__.py +++ b/torrentSearch/__init__.py @@ -7,4 +7,15 @@ from sys import path from os.path import dirname path.append(dirname(__file__)) -__version__ = '0.1.post1' +__version__ = '0.1.2' + +import logging +from utils import ColorizeFilter +ch = logging.StreamHandler() +formatter = logging.Formatter('%(asctime)s %(levelname)8s %(name)s | %(message)s') +ch.setFormatter(formatter) + +logger = logging.getLogger('torrentSearch') +logger.addHandler(ch) +logger.setLevel(logging.ERROR) # This toggles all the logging in your app +logger.addFilter(ColorizeFilter()) diff --git a/torrentSearch/__main__.py b/torrentSearch/__main__.py index 617e3d0..2ce0abd 100644 --- a/torrentSearch/__main__.py +++ b/torrentSearch/__main__.py @@ -28,16 +28,9 @@ from docopt import docopt from __init__ import __version__ from search import searchTorrentSite -from utils import ColorizeFilter, getConfig - -ch = logging.StreamHandler() -formatter = logging.Formatter('%(asctime)s %(levelname)8s %(name)s | %(message)s') -ch.setFormatter(formatter) +from utils import getConfig logger = logging.getLogger('torrentSearch') -logger.addHandler(ch) -logger.setLevel(logging.ERROR) # This toggles all the logging in your app -logger.addFilter(ColorizeFilter()) def main(): """