forest/utils/misc/
mod.rs

1// Copyright 2019-2026 ChainSafe Systems
2// SPDX-License-Identifier: Apache-2.0, MIT
3
4use is_terminal::IsTerminal;
5
6mod adaptive_value_provider;
7pub use adaptive_value_provider::*;
8mod logo;
9pub use logo::*;
10pub mod env;
11
12#[derive(Debug, Default, Clone, PartialEq, Eq, strum::EnumString)]
13#[strum(serialize_all = "kebab-case")]
14pub enum LoggingColor {
15    Always,
16    #[default]
17    Auto,
18    Never,
19}
20
21impl LoggingColor {
22    pub fn coloring_enabled(&self) -> bool {
23        match self {
24            LoggingColor::Auto => std::io::stdout().is_terminal(),
25            LoggingColor::Always => true,
26            LoggingColor::Never => false,
27        }
28    }
29}