← Back to issue list

emit.pause is creating new Printer, but not updating printer for logging

View original Github issue

Metadata

Project
craft-cli
Number
#139
Type
issue
State
closed
Author
rgildein
Labels
—
Created
Updated
Closed

Current evaluation

Fixed in canonical/craft-cli#140, merged as commit 585f41d; emit.pause() now assigns the replacement printer to the logging handler.

Resolution: closed resolved

Reason: Issue #139 was resolved by canonical/craft-cli#140, merged as commit 585f41d. The fix updates emit.pause() so both the emitter and _log_handler use the newly created Printer.

Evaluated by: mr-cal-bot

No scores available.

Issue body

The `emit.pause` is stopping printer and than creating new one, however the `emit._log_handler` is still using old printer. How to reproduced. ```python import logging from craft_cli.messages import EmitterMode, emit logger = logging.getLogger(__name__) def main(): emit.init(EmitterMode.VERBOSE, "test", "test emit.pause") logger = logging.getLogger() logger.setLevel(logging.DEBUG) # test part emit.message("EMIT: start") logger.info("logging: start") with emit.pause(): print("pause") logger.info("logging: stop") emit.message("EMIT: stop") if __name__ == "__main__": main() ``` ### actual behavior ```bash (.venv) x1:➜ craft-cli git:(main) ✗ python3 -m test test emit.pause Logging execution to '/home/rgildein/.local/state/test/log/test-20230228-182816.590736.log' EMIT: start logging: start pause EMIT: stop [0.17s] ``` ### expected bahvior ```bash (.venv) x1:➜ craft-cli git:(main) ✗ python3 -m test test emit.pause Logging execution to '/home/rgildein/.local/state/test/log/test-20230228-182828.684952.log' EMIT: start logging: start pause logging: stop EMIT: stop ``` Issue is in this [line](https://github.com/canonical/craft-cli/blob/main/craft_cli/messages.py#L618) of code where new printer is created, but it's not updated for `self._log_handler.printer`.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Fixed in canonical/craft-cli#140, merged as commit 585f41d; emit.pause() now assigns the replacement printer to the logging handler.
stealth/space-bunny-alpha — closed resolved Fixed in canonical/craft-cli#140, merged as 585f41d: emit.pause() now updates the logging handler to use its replacement printer.
stealth/space-bunny-alpha — closed resolved Fixed in canonical/craft-cli#140, merged as 585f41d: emit.pause() now updates the logging handler to use its replacement printer.
qwen/qwen3.6-35b-a3b — — Fixed by assigning the newly created printer to self._log_handler.printer in emit.pause(), restoring correct logging behavior during paused emission.
qwen/qwen3.6-35b-a3b — — Fixed by updating the log handler's printer reference when emit.pause() creates a new instance, ensuring logging continues during paused emission.
qwen/qwen3.6-35b-a3b — — emit.pause() creates a new Printer but fails to update the log handler reference, breaking logging during pauses. The issue was closed without a fix or resolution details provided.
qwen/qwen3.6-35b-a3b — — Fixed by updating the log handler printer reference when emit.pause() creates a new instance, restoring logging functionality during the pause context.

Update history

No update history recorded yet.

Related work

  • Likely Fixed By: canonical/craft-cli#140 (confidence 100%)

    PR #140 contains the fix and was merged as commit 585f41d.

Related issues

Issue Project State Summary Similarity
#140 fix new printer for logging handler craft-cli merged Merged as 585f41d; emit.pause() now refreshes the logging handler's printer when creating its replacement, fixing #139.
76%