Use local logging module
This ensures logging is configured in one place
MODIFY
plex_trakt_sync/main.py
plex_trakt_sync/main.py
import plexapi.server
import trakt
-from plex_trakt_sync.path import pytrakt_file, env_file, log_file
+from plex_trakt_sync.path import pytrakt_file, env_file
trakt.core.CONFIG_PATH = pytrakt_file
import trakt.movies
import trakt.tv
import trakt.sync
import trakt.users
import trakt.core
-import logging
from time import time, sleep
import datetime
from json.decoder import JSONDecodeError
from plex_trakt_sync import pytrakt_extensions
from plex_trakt_sync.trakt_list_util import TraktListUtil
from plex_trakt_sync.config import CONFIG
+from plex_trakt_sync.logging import logging
import requests_cache
@@ -396,10 +396,6 @@ def respect_trakt_rate(last_time):
def main():
start_time = time()
- logLevel = logging.DEBUG if CONFIG['log_debug_messages'] else logging.INFO
- logging.basicConfig(format='%(asctime)s %(levelname)s:%(message)s',
- handlers=[logging.FileHandler(log_file, 'w', 'utf-8')],
- level=logLevel)
listutil = TraktListUtil()
# do not use the cache for account specific stuff as this is subject to change
start_msg = "Starting sync Plex {} and Trakt {}".format(CONFIG['PLEX_USERNAME'], CONFIG['TRAKT_USERNAME'])

Use local logging module

This ensures logging is configured in one place