diff --git a/kolibri/utils/logger.py b/kolibri/utils/logger.py index d8c0ba68c91..e35d9346340 100644 --- a/kolibri/utils/logger.py +++ b/kolibri/utils/logger.py @@ -2,9 +2,6 @@ import os from logging.handlers import TimedRotatingFileHandler -from colorlog import ColoredFormatter -from colorlog import TTYColoredFormatter as BaseTTYColoredFormatter - GET_FILES_TO_DELETE = "getFilesToDelete" DO_ROLLOVER = "doRollover" @@ -168,24 +165,6 @@ def filter(self, record): return record.levelno < logging.ERROR -class TTYColoredFormatter(BaseTTYColoredFormatter): - """ - A logging formatter that can be used to colorize output to a TTY. - Subclassed from the base TTY formatter to allow slightly more more permissive - color formatting when we are running using the NPM concurrently package, - which does not register as a TTY context. - """ - - def color(self, log_colors, level_name): - """ - Only returns colors if STDOUT is a TTY, or if we are running in a - NPM concurrently context. - """ - if not self.stream.isatty() and "FORCE_COLOR" not in os.environ: - log_colors = {} - return ColoredFormatter.color(self, log_colors, level_name) - - def get_default_logging_config(LOG_ROOT, debug=False, debug_database=False): """ A minimal logging config for just kolibri without any Django @@ -255,7 +234,7 @@ def get_default_logging_config(LOG_ROOT, debug=False, debug_database=False): }, "simple_date": {"format": "%(levelname)s %(asctime)s %(name)s %(message)s"}, "color": { - "()": "kolibri.utils.logger.TTYColoredFormatter", + "()": "colorlog.ColoredFormatter", "format": "%(log_color)s%(levelname)-8s %(asctime)s %(message)s", "log_colors": LOG_COLORS, }, diff --git a/requirements/base.txt b/requirements/base.txt index 3f052fb078c..c39485f58a1 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -3,7 +3,7 @@ django-filter==21.1 django-js-reverse==0.10.2 djangorestframework==3.14.0 django==3.2.25 -colorlog==3.2.0 # pyup: <4.0.0 +colorlog==6.8.2 configobj==5.0.6 django-mptt==0.14.0 requests==2.27.1