Skip to content

Commit

Permalink
moved log to dev-dep, removed env_logger
Browse files Browse the repository at this point in the history
  • Loading branch information
brhoades committed Feb 23, 2021
1 parent 55d4846 commit daf3a87
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 211 deletions.
211 changes: 3 additions & 208 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "adaptive_backoff"
version = "0.2.0"
version = "0.2.1"
authors = ["Billy Rhoades <me@brod.es>"]
edition = "2018"
license = "MIT"
Expand All @@ -15,8 +15,8 @@ keywords = ["adaptive", "backoff", "ratelimit", "throttle"]
anyhow = "1.0"
thiserror = "1.0"

[dev-dependencies]
log = "0.4"
pretty_env_logger = "0.3"

[lib]
name = "adaptive_backoff"
Expand Down
3 changes: 3 additions & 0 deletions src/lib/adaptive.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::time::Duration;

#[cfg(test)]
use log::trace;

use crate::{backoff::*, errors::*};
Expand Down Expand Up @@ -188,6 +189,7 @@ impl<B: Backoff> Adaptable for Adaptive<B> {
None => self.delay = Duration::new(0, 0),
}

#[cfg(test)]
trace!(
"success count now {} with delay @ {:?}",
self.success_factor,
Expand All @@ -203,6 +205,7 @@ impl<B: Backoff> Adaptable for Adaptive<B> {
let delta = self.backoff.wait().div_f64(self.fail_factor);
self.delay += delta;

#[cfg(test)]
trace!(
"fail count now {}, delta {:?} added to delay, now @ {:?}",
self.fail_factor,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/backoff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ fn test_exp_backoff() {
.factor(2.0)
.build();

assert!(backoff.is_ok(), backoff.err());
assert!(backoff.is_ok(), "{:?}", backoff.err());
let mut backoff = backoff.unwrap();

for i in 1..20 {
Expand Down

0 comments on commit daf3a87

Please sign in to comment.