Skip to content

Commit

Permalink
Replace "Current" with a "Completed" status (when final)
Browse files Browse the repository at this point in the history
  • Loading branch information
kedNalatacId committed Jun 21, 2024
1 parent 0fc3bc1 commit b7deed9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Fill.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ def log_fill_progress(self, name: str, placed: int, final: bool = False) -> None
# any non-CLI logging; just log 10x times (or fewer), no need for anything fancy
def log_nontty(self, name: str, placed: int, final: bool) -> None:
if final or placed % self.step == 0:
status: str = "Finished" if final else "Current"
pct: float = round(100 * (placed / self.total_items), 2)
logging.info(f"Current fill step ({name}) at {placed}/{self.total_items} ({pct}%) items placed.")
logging.info(f"{status} fill step ({name}) at {placed}/{self.total_items} ({pct}%) items placed.")

# on CLI, be a little friendlier
def log_tty(self, name: str, placed: int, final: bool) -> None:
Expand All @@ -60,9 +61,10 @@ def log_tty(self, name: str, placed: int, final: bool) -> None:
if not final:
logging.StreamHandler.terminator = '\r'

status: str = "Finished" if final else "Current"
pct: float = round(100 * (placed / self.total_items), 2)
elapsed: str = time.strftime("%Hh:%Mm:%Ss", time.gmtime(round(self.cur_time - self.start_time)))
logging.info(f"Current fill step ({name}) at {placed}/{self.total_items} ({pct}%) items placed [{elapsed} elapsed].")
logging.info(f"{status} fill step ({name}) at {placed}/{self.total_items} ({pct}%) items placed [{elapsed} elapsed].")

# restore the terminator
logging.StreamHandler.terminator = old_term
Expand Down

0 comments on commit b7deed9

Please sign in to comment.