Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not configure logger in codemodder.run #905

Merged
merged 4 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 2 additions & 13 deletions src/codemodder/codemodder.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,7 @@
from codemodder.context import CodemodExecutionContext
from codemodder.dependency import Dependency
from codemodder.llm import MisconfiguredAIClient
from codemodder.logging import (
OutputFormat,
configure_logger,
log_list,
log_section,
logger,
)
from codemodder.logging import configure_logger, log_list, log_section, logger
from codemodder.project_analysis.file_parsers.package_store import PackageStore
from codemodder.project_analysis.python_repo_manager import PythonRepoManager
from codemodder.result import ResultSet
Expand Down Expand Up @@ -124,8 +118,6 @@ def run(
output: Path | str | None = None,
output_format: str = "codetf",
verbose: bool = False,
log_format: OutputFormat = OutputFormat.JSON,
project_name: str | None = None,
tool_result_files_map: DefaultDict[str, list[Path]] = defaultdict(list),
path_include: list[str] | None = None,
path_exclude: list[str] | None = None,
Expand All @@ -148,8 +140,6 @@ def run(

provider_registry = providers.load_providers()

configure_logger(verbose, log_format, project_name)

log_section("startup")
logger.info("codemodder: python/%s", __version__)

Expand Down Expand Up @@ -254,15 +244,14 @@ def _run_cli(original_args) -> int:
tool_result_files_map["defectdojo"].extend(argv.defectdojo_findings_json or [])

logger.info("command: %s %s", Path(sys.argv[0]).name, " ".join(original_args))
configure_logger(argv.verbose, argv.log_format, argv.project_name)

_, status = run(
argv.directory,
argv.dry_run,
argv.output,
argv.output_format,
argv.verbose,
argv.log_format,
argv.project_name,
tool_result_files_map,
argv.path_include,
argv.path_exclude,
Expand Down
2 changes: 1 addition & 1 deletion src/codemodder/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,6 @@ def configure_logger(

logging.basicConfig(
format="%(message)s",
level=log_level,
handlers=handlers,
)
logger.setLevel(log_level)
Loading