From cfe9093fd8bee1ec7fda68f8aa6500620e68c88e Mon Sep 17 00:00:00 2001
From: Oakchris1955 <80592203+Oakchris1955@users.noreply.github.com>
Date: Wed, 19 Jun 2024 12:47:29 +0300
Subject: [PATCH 1/3] Remove is-terminal dependency
The unstable feature "is_terminal" of the Standard Library has been stabilized since 1.70.0, which is also the MSRV of this crate
---
Cargo.toml | 3 +--
README.md | 5 ++---
examples/colors.rs | 2 +-
examples/colors2.rs | 2 +-
scripts/qualify.rs | 1 -
src/code_examples.md | 3 ---
src/formats.rs | 3 ---
src/logger.rs | 17 ++---------------
8 files changed, 7 insertions(+), 29 deletions(-)
diff --git a/Cargo.toml b/Cargo.toml
index dcf0654..31649ab 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -30,7 +30,7 @@ rustdoc-args = ["--cfg", "docsrs"]
[features]
default = ["colors", "textfilter"]
async = ["dep:crossbeam-channel", "dep:crossbeam-queue"]
-colors = ["dep:nu-ansi-term", "is-terminal"]
+colors = ["dep:nu-ansi-term"]
compress = ["dep:flate2"]
dont_minimize_extra_stacks = []
json = ["dep:serde_json", "dep:serde", "dep:serde_derive"]
@@ -42,7 +42,6 @@ textfilter = ["dep:regex"]
trc = ["async", "specfile", "dep:tracing", "dep:tracing-subscriber"]
[dependencies]
-is-terminal = { version = "0.4", optional = true }
nu-ansi-term = { version = "0.50", optional = true }
chrono = { version = "0.4.22", default-features = false, features = ["clock"] }
crossbeam-channel = { version = "0.5", optional = true }
diff --git a/README.md b/README.md
index 02df4ab..f1d7e44 100644
--- a/README.md
+++ b/README.md
@@ -107,8 +107,7 @@ The default feature `colors` simplifies this by doing three things:
* provides additional colored pendants to the existing uncolored format functions
* it uses `colored_default_format()` for the output to stderr,
and the non-colored `default_format()` for the output to files
-* it activates the optional dependency to `is-terminal` to being able to switch off
- coloring if the output is not sent to a terminal but e.g. piped to another program.
+* it switches off coloring if the output is not sent to a terminal but e.g. piped to another program.
**Colors**,
or styles in general, are a matter of taste, and no choice will fit every need.
So you can override the default formatting and coloring in various ways.
-With switching off the default features and choosing feature `is-terminal` explicitly
+With switching off the default features
(see [usage](#usage)) you can remove the `nu_ansi_term`-based coloring
but keep the capability to switch off your own coloring.
diff --git a/examples/colors.rs b/examples/colors.rs
index dacf95e..794de2e 100644
--- a/examples/colors.rs
+++ b/examples/colors.rs
@@ -4,7 +4,7 @@ fn main() {
#[cfg(feature = "colors")]
{
- use is_terminal::IsTerminal;
+ use std::io::IsTerminal;
use nu_ansi_term::Color;
for i in 0..=255 {
diff --git a/examples/colors2.rs b/examples/colors2.rs
index adfa531..90eed79 100644
--- a/examples/colors2.rs
+++ b/examples/colors2.rs
@@ -9,7 +9,7 @@ fn main() {
// #[cfg(feature = "colors")]
// {
- // use is_terminal::IsTerminal;;
+ // use std::io::IsTerminal;;
// colored::control::set_override(true);
diff --git a/scripts/qualify.rs b/scripts/qualify.rs
index 37a9f77..d2fafba 100755
--- a/scripts/qualify.rs
+++ b/scripts/qualify.rs
@@ -55,7 +55,6 @@ fn main() {
run_command!("cargo build");
run_command!("cargo build --no-default-features");
#[rustfmt::skip]
- run_command!("cargo build --no-default-features --features=is-terminal");
run_command!("cargo build --all-features");
run_command!("cargo build --release");
run_command!("cargo build --release --all-features");
diff --git a/src/code_examples.md b/src/code_examples.md
index 4098a29..c0f8c2f 100644
--- a/src/code_examples.md
+++ b/src/code_examples.md
@@ -259,10 +259,8 @@ by providing one of the variants of [`AdaptiveFormat`](crate::AdaptiveFormat) to
format method, e.g.
```rust
-# #[cfg(feature = "is-terminal")]
# use flexi_logger::AdaptiveFormat;
# fn main() -> Result<(), Box> {
-# #[cfg(feature = "is-terminal")]
# {
flexi_logger::Logger::try_with_str("info")?
.adaptive_format_for_stderr(AdaptiveFormat::Detailed);
@@ -276,7 +274,6 @@ format method, e.g.
`flexi_logger` initializes by default equivalently to this:
```rust
-# #[cfg(feature = "is-terminal")]
# mod example {
# use flexi_logger::{Logger,AdaptiveFormat,default_format, FileSpec};
# use log::{debug, error, info, trace, warn};
diff --git a/src/formats.rs b/src/formats.rs
index 7d6e665..d5f20b3 100644
--- a/src/formats.rs
+++ b/src/formats.rs
@@ -455,8 +455,6 @@ fn parse_style(input: &str) -> Result