Skip to content
This repository was archived by the owner on Nov 6, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 27 additions & 18 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ semver = "0.9"
ansi_term = "0.10"
parking_lot = "0.5"
regex = "0.2"
isatty = "0.1"
atty = "0.2.8"
toml = "0.4"
serde = "1.0"
serde_json = "1.0"
Expand Down
2 changes: 1 addition & 1 deletion logger/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
[dependencies]
log = "0.3"
env_logger = "0.4"
isatty = "0.1"
atty = "0.2"
lazy_static = "1.0"
regex = "0.2"
time = "0.1"
Expand Down
14 changes: 7 additions & 7 deletions logger/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,23 @@

//! Logger for parity executables

extern crate ansi_term;
extern crate arrayvec;
extern crate atty;
extern crate env_logger;
extern crate log as rlog;
extern crate isatty;
extern crate parking_lot;
extern crate regex;
extern crate env_logger;
extern crate time;

#[macro_use]
extern crate lazy_static;
extern crate parking_lot;
extern crate ansi_term;

mod rotating;

use std::{env, thread, fs};
use std::sync::{Weak, Arc};
use std::io::Write;
use isatty::{stderr_isatty, stdout_isatty};
use env_logger::LogBuilder;
use regex::Regex;
use ansi_term::Colour;
Expand Down Expand Up @@ -86,7 +86,7 @@ pub fn setup_log(config: &Config) -> Result<Arc<RotatingLogger>, String> {
builder.parse(s);
}

let isatty = stderr_isatty();
let isatty = atty::is(atty::Stream::Stderr);
let enable_color = config.color && isatty;
let logs = Arc::new(RotatingLogger::new(levels));
let logger = logs.clone();
Expand Down Expand Up @@ -122,7 +122,7 @@ pub fn setup_log(config: &Config) -> Result<Arc<RotatingLogger>, String> {
let _ = file.write_all(b"\n");
}
logger.append(removed_color);
if !isatty && record.level() <= LogLevel::Info && stdout_isatty() {
if !isatty && record.level() <= LogLevel::Info && atty::is(atty::Stream::Stdout) {
// duplicate INFO/WARN output to console
println!("{}", ret);
}
Expand Down
4 changes: 2 additions & 2 deletions parity/informant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use std::sync::{Arc};
use std::sync::atomic::{AtomicUsize, AtomicBool, Ordering as AtomicOrdering};
use std::time::{Instant, Duration};

use atty;
use ethcore::client::{
BlockId, BlockChainClient, ChainInfo, BlockInfo, BlockChainInfo,
BlockQueueInfo, ChainNotify, ClientReport, Client, ClientIoMessage
Expand All @@ -31,7 +32,6 @@ use ethcore::snapshot::{RestorationStatus, SnapshotService as SS};
use ethcore::snapshot::service::Service as SnapshotService;
use sync::{LightSyncProvider, LightSync, SyncProvider, ManageNetwork};
use io::{TimerToken, IoContext, IoHandler};
use isatty::{stdout_isatty};
use light::Cache as LightDataCache;
use light::client::LightChainClient;
use number_prefix::{binary_prefix, Standalone, Prefixed};
Expand Down Expand Up @@ -293,7 +293,7 @@ impl<T: InformantData> Informant<T> {

*self.last_tick.write() = Instant::now();

let paint = |c: Style, t: String| match self.with_color && stdout_isatty() {
let paint = |c: Style, t: String| match self.with_color && atty::is(atty::Stream::Stdout) {
true => format!("{}", c.paint(t)),
false => t,
};
Expand Down
2 changes: 1 addition & 1 deletion parity/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ extern crate env_logger;
extern crate fdlimit;
extern crate futures;
extern crate futures_cpupool;
extern crate isatty;
extern crate atty;
extern crate jsonrpc_core;
extern crate num_cpus;
extern crate number_prefix;
Expand Down