canonical / craft-cli

https://canonical-craft-cli.readthedocs-hosted.com/en/latest/
GNU Lesser General Public License v3.0
9 stars 15 forks source link

printer: always flush when logging messages #163

Closed tigarmo closed 1 year ago

tigarmo commented 1 year ago

With this commit, every write() call to the Printer's logfile is followed by an explicit call to flush(). This is in line with the standard library's FileHandler behavior, and lets us correctly write to file messages logged from child processes (multiprocessing). Without this, the files are written() to but the child process dies without flushing them to disk, so they are lost.

CRAFT-1856

codecov[bot] commented 1 year ago

Codecov Report

Merging #163 (77aa8a6) into main (5f880f4) will increase coverage by 0.00%. The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main     #163   +/-   ##
=======================================
  Coverage   94.40%   94.40%           
=======================================
  Files           7        7           
  Lines        1018     1019    +1     
  Branches      187      187           
=======================================
+ Hits          961      962    +1     
  Misses         53       53           
  Partials        4        4           
Impacted Files Coverage Δ
craft_cli/printer.py 100.00% <100.00%> (ø)