GRM-15: fix: eliminate duplicate console output, restore GRM_LOG_LEVEL filtering
- Remove console StreamHandler from get_logger() — say() already handles console output via click.echo(); having both caused every message to appear twice - Move GRM_LOG_LEVEL filtering into ui.say() via _console_level() so console verbosity is still user-controllable while the log file always captures everything at DEBUG - Remove [GRM] prefix from say() calls — no longer needed without duplicate logger output, giving cleaner user-facing messages - Update test_logging_config.py: remove console handler tests and _level_from_env tests (now in test_ui.py), expect 1 handler only - Add test_ui.py coverage for _console_level and say() level filtering - Update README to document single-path console output via click.echo - 116 tests, 100% coverage, pyright clean, ruff clean
This commit is contained in:
@@ -27,8 +27,8 @@ class AnsibleExecutor:
|
||||
log_file = self._prepare_log(cmd)
|
||||
desc = description or _("Running Ansible playbook")
|
||||
|
||||
say(f"[GRM] {desc}", color="cyan")
|
||||
say(f"[GRM] {_('Full log: {log_file}', log_file=log_file)}")
|
||||
say(desc, color="cyan")
|
||||
say(_("Full log: {log_file}", log_file=log_file))
|
||||
|
||||
returncode = self._stream(cmd, log_file)
|
||||
|
||||
@@ -38,14 +38,14 @@ class AnsibleExecutor:
|
||||
code=returncode,
|
||||
log_file=log_file,
|
||||
)
|
||||
say(f"[GRM] {msg}", level=logging.ERROR, err=True, color="red")
|
||||
say(msg, level=logging.ERROR, err=True, color="red")
|
||||
raise AnsibleError(msg)
|
||||
|
||||
status = self._extract_status(log_file)
|
||||
if status:
|
||||
say(f"[GRM] {status}", color="yellow")
|
||||
say(status, color="yellow")
|
||||
|
||||
say(f"[GRM] {_('Done. See full log: {log_file}', log_file=log_file)}", color="green")
|
||||
say(_("Done. See full log: {log_file}", log_file=log_file), color="green")
|
||||
|
||||
def _prepare_log(self, cmd: list[str]) -> Path:
|
||||
"""Create a log file with header."""
|
||||
|
||||
Reference in New Issue
Block a user