Skip to content

Commit

Permalink
fix(logger): replace atty with is_terminal() to fix cargo-audit
Browse files Browse the repository at this point in the history
  • Loading branch information
loyd committed Nov 18, 2024
1 parent 977a117 commit 6a4522d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- logger: use `/` as a delimiter between an actor's group and key ([#74]).
- core/addr: expose the `addr` module.
- core: generate `NodeNo` randomly if not provided.
- network: don't force `safe-*` features of lz4_flex ([#136]).
- network: don't force `safe-*` features of the `lz4_flex` crate ([#136]).

### Fixed
- core: update the `idr-ebr` crate to v0.3 to fix possible crash in `Context::finished()`.
- logger: replace the `atty` crate with `IsTerminal` to fix cargo-audit warnings.

[#74]: https://github.com/elfo-rs/elfo/issues/74
[#135]: https://github.com/elfo-rs/elfo/pull/135
Expand Down
1 change: 0 additions & 1 deletion elfo-logger/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ tokio = { workspace = true, features = ["macros", "fs", "io-util"] }
arc-swap = "1.2.0"
once_cell = { version = "1.8.0", features = ["parking_lot"] }
futures-intrusive = "0.5"
atty = "0.2.14"
serde = { version = "1.0.120", features = ["derive"] }
parking_lot = "0.12"
sharded-slab = "0.1.7"
Expand Down
8 changes: 6 additions & 2 deletions elfo-logger/src/actor.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
use std::{sync::Arc, time::Duration};
use std::{
io::{self, IsTerminal as _},
sync::Arc,
time::Duration,
};

use metrics::increment_counter;
use tokio::{
Expand Down Expand Up @@ -226,7 +230,7 @@ async fn open_file(config: &Config) -> Option<File> {
}

fn can_use_colors(config: &Config) -> bool {
config.sink == Sink::Stdout && atty::is(atty::Stream::Stdout)
config.sink == Sink::Stdout && io::stdout().is_terminal()
}

fn extract_location(metadata: &Metadata<'static>) -> Option<(&'static str, u32)> {
Expand Down

0 comments on commit 6a4522d

Please sign in to comment.