Skip to content

Commit

Permalink
Remove simplelog crate and MaybeWriteLogger type
Browse files Browse the repository at this point in the history
[ci skip-build-wheels]
  • Loading branch information
gshuflin committed Aug 25, 2020
1 parent 059393b commit 40d6b13
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 74 deletions.
44 changes: 0 additions & 44 deletions src/rust/engine/Cargo.lock

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

4 changes: 1 addition & 3 deletions src/rust/engine/logging/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ lazy_static = "1"
log = "0.4"
num_enum = "0.4"
parking_lot = "0.11"
simplelog = "0.7.4"
# TODO: See #10291.
tokio = { version = "=0.2.20", features = ["rt-util"] }
tokio = { version = "=0.2.20", features = ["rt-util"] } # TODO: see https://github.com/pantsbuild/pants/issues/10291
uuid = { version = "0.7", features = ["v4"] }

[build-dependencies]
Expand Down
27 changes: 0 additions & 27 deletions src/rust/engine/logging/src/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ use std::sync::atomic::{AtomicBool, Ordering};
use lazy_static::lazy_static;
use log::{debug, log, max_level, set_logger, set_max_level, LevelFilter, Log, Metadata, Record};
use parking_lot::Mutex;
use simplelog::WriteLogger;
use tokio::task_local;
use uuid::Uuid;

Expand Down Expand Up @@ -201,32 +200,6 @@ impl Log for PantsLogger {
fn flush(&self) {}
}

struct MaybeWriteLogger<W: Write + Send + 'static> {
inner: Option<Box<WriteLogger<W>>>,
}

impl<W: Write + Send + 'static> Log for MaybeWriteLogger<W> {
fn enabled(&self, _metadata: &Metadata) -> bool {
// PantsLogger will have already filtered using the global filter.
true
}

fn log(&self, record: &Record) {
if !self.enabled(record.metadata()) {
return;
}
if let Some(ref logger) = self.inner {
logger.log(record);
}
}

fn flush(&self) {
if let Some(ref logger) = self.inner {
logger.flush();
}
}
}

///
/// Thread- or task-local context for where the Logger should send log statements.
///
Expand Down

0 comments on commit 40d6b13

Please sign in to comment.