env_logger/fmt/writer/atty.rs
1/*
2This internal module contains the terminal detection implementation.
3
4If the `atty` crate is available then we use it to detect whether we're
5attached to a particular TTY. If the `atty` crate is not available we
6assume we're not attached to anything. This effectively prevents styles
7from being printed.
8*/
9
10#[cfg(feature = "atty")]
11mod imp {
12 use atty;
13
14 pub(in crate::fmt) fn is_stdout() -> bool {
15 atty::is(atty::Stream::Stdout)
16 }
17
18 pub(in crate::fmt) fn is_stderr() -> bool {
19 atty::is(atty::Stream::Stderr)
20 }
21}
22
23#[cfg(not(feature = "atty"))]
24mod imp {
25 pub(in crate::fmt) fn is_stdout() -> bool {
26 false
27 }
28
29 pub(in crate::fmt) fn is_stderr() -> bool {
30 false
31 }
32}
33
34pub(in crate::fmt) use self::imp::*;