From 1fced2b89a0c81b85a935c4dd24ef738111d781e Mon Sep 17 00:00:00 2001 From: Fry Date: Thu, 3 Sep 2026 03:07:08 +0000 Subject: [PATCH 1/2] Remove custom logger class --- dftimewolf/cli/dftimewolf_recipes.py | 7 ++----- dftimewolf/lib/logging_utils.py | 15 --------------- dftimewolf/lib/module.py | 5 ++--- 3 files changed, 4 insertions(+), 23 deletions(-) diff --git a/dftimewolf/cli/dftimewolf_recipes.py b/dftimewolf/cli/dftimewolf_recipes.py index 6151f04d5..ad017e476 100644 --- a/dftimewolf/cli/dftimewolf_recipes.py +++ b/dftimewolf/cli/dftimewolf_recipes.py @@ -64,7 +64,7 @@ } -logger = cast(logging_utils.WolfLogger, logging.getLogger('dftimewolf')) +logger = logging.getLogger('dftimewolf') class DFTimewolfTool(object): @@ -87,7 +87,7 @@ def __init__( self._recipes_manager = recipes_manager.RecipesManager() self._recipe: resources.Recipe self._uuid = workflow_uuid or str(uuid.uuid4()) - logger.success(f'dfTimewolf tool initialized with UUID: {self._uuid}') + logger.info(f'dfTimewolf tool initialized with UUID: {self._uuid}') self._DetermineDataFilesPath() self.LoadConfiguration(config_path) @@ -394,9 +394,6 @@ def SetupLogging(stdout_log: bool = False) -> None: Args: stdout_log (bool): Whether to log to stdout as well as a file. """ - # Add a custom level name - logging.addLevelName(logging_utils.SUCCESS, 'SUCCESS') - # Clear handlers (for dependencies that are setting them) root_log = logging.getLogger() root_log.handlers = [] diff --git a/dftimewolf/lib/logging_utils.py b/dftimewolf/lib/logging_utils.py index 448205bba..35617bc3a 100644 --- a/dftimewolf/lib/logging_utils.py +++ b/dftimewolf/lib/logging_utils.py @@ -20,13 +20,8 @@ def GenerateTempLogFile() -> str: logfile.close() return log_filename - -SUCCESS = 25 # 25 is right between INFO and WARNING - - LEVEL_COLOR_MAP = { 'WARNING': '\u001b[0;93m', - 'SUCCESS': '\u001b[1;30;42m', 'INFO': '\u001b[0;97m', 'DEBUG': '\u001b[0;94m', 'CRITICAL': '\u001b[1;31;107m', @@ -40,16 +35,6 @@ def GenerateTempLogFile() -> str: _DEFAULT_FORMATTER = logging.Formatter('[%(asctime)sZ] [%(name)-20s] %(levelname)-8s %(message)s') -class WolfLogger(logging.Logger): - """Custom logging Class with a `success` logging function.""" - - def success(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=invalid-name - """Logs a success message.""" - super(WolfLogger, self).log(SUCCESS, *args, **kwargs) - -logging.setLoggerClass(WolfLogger) - - class WolfFormatter(logging.Formatter): """Helper class used to add color to log messages depending on their level.""" diff --git a/dftimewolf/lib/module.py b/dftimewolf/lib/module.py index aa60edf0c..655c31597 100644 --- a/dftimewolf/lib/module.py +++ b/dftimewolf/lib/module.py @@ -54,8 +54,7 @@ def __init__(self, self._telemetry = telemetry_ self._publish_message_callback = publish_message_callback - self.logger = cast(logging_utils.WolfLogger, - logging.getLogger(name=self.name)) + self.logger = logging.getLogger(name=self.name) self.logger.parent = logging.getLogger('dftimewolf') def LogTelemetry(self, data: dict[str, str]) -> None: @@ -141,7 +140,7 @@ def PublishMessage( elif is_error: self.logger.error(message) else: - self.logger.success(message) + self.logger.info(message) self._publish_message_callback(self.name, message, is_error) def RegisterStreamingCallback( From a689abc6311c7923e7dcc289b8ff4568e6fbb646 Mon Sep 17 00:00:00 2001 From: Fry Date: Thu, 3 Sep 2026 03:11:06 +0000 Subject: [PATCH 2/2] Lint --- dftimewolf/cli/dftimewolf_recipes.py | 2 +- dftimewolf/lib/module.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/dftimewolf/cli/dftimewolf_recipes.py b/dftimewolf/cli/dftimewolf_recipes.py index ad017e476..70cca766b 100644 --- a/dftimewolf/cli/dftimewolf_recipes.py +++ b/dftimewolf/cli/dftimewolf_recipes.py @@ -9,7 +9,7 @@ import sys import typing import uuid -from typing import Any, Optional, cast +from typing import Any, Optional from dftimewolf import config from dftimewolf.lib import errors diff --git a/dftimewolf/lib/module.py b/dftimewolf/lib/module.py index 655c31597..b58fa79b0 100644 --- a/dftimewolf/lib/module.py +++ b/dftimewolf/lib/module.py @@ -5,11 +5,10 @@ import logging import sys import traceback -from typing import Any, Callable, Literal, NoReturn, Optional, overload, Sequence, Type, TypeVar, cast +from typing import Any, Callable, Literal, NoReturn, Optional, overload, Sequence, Type, TypeVar from dftimewolf.lib import cache from dftimewolf.lib import errors -from dftimewolf.lib import logging_utils from dftimewolf.lib import spanner_telemetry as telemetry from dftimewolf.lib import opentelemetry from dftimewolf.lib.containers import interface