Skip to content

Commit

Permalink
log progress now works with units
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Aug 10, 2020
1 parent 006ba9d commit 37f1266
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/progress/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,8 @@ impl Progress for Log {
> EMIT_LOG_EVERY_S
{
self.last_set = Some(now);
match (self.max, self.unit) {
(Some(max), Some(unit)) => log::info!("{} → {} / {} {}", self.name, step, max, unit),
(None, Some(unit)) => log::info!("{} → {} {}", self.name, step, unit),
match (self.max, &self.unit) {
(max, Some(unit)) => log::info!("{} → {}", self.name, unit.display(step, max, None)),
(Some(max), None) => log::info!("{} → {} / {}", self.name, step, max),
(None, None) => log::info!("{} → {}", self.name, step),
}
Expand Down
4 changes: 2 additions & 2 deletions src/unit/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ impl Unit {
&self,
current_value: Step,
upper_bound: Option<Step>,
elapsed: impl Into<Option<display::Throughput>>,
throughput: impl Into<Option<display::Throughput>>,
) -> display::UnitDisplay {
display::UnitDisplay {
current_value,
upper_bound,
throughput: elapsed.into(),
throughput: throughput.into(),
parent: self,
display: display::What::ValuesAndUnit,
}
Expand Down

0 comments on commit 37f1266

Please sign in to comment.