diff --git a/Cargo.lock b/Cargo.lock index a0ad6bede..d039c1646 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,7 +2,7 @@ name = "parity" version = "1.7.0" dependencies = [ - "ansi_term 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "app_dirs 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "ctrlc 1.1.1 (git+https://github.com/ethcore/rust-ctrlc.git)", @@ -39,6 +39,7 @@ dependencies = [ "parity-reactor 0.1.0", "parity-rpc-client 1.4.0", "parity-updater 1.7.0", + "path 0.1.0", "regex 0.1.68 (registry+https://github.com/rust-lang/crates.io-index)", "rlp 0.1.0", "rpassword 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -72,7 +73,7 @@ dependencies = [ [[package]] name = "ansi_term" -version = "0.7.2" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -93,10 +94,10 @@ dependencies = [ [[package]] name = "arrayvec" -version = "0.3.16" +version = "0.3.20" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "nodrop 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "nodrop 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "odds 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -347,7 +348,7 @@ name = "eth-secp256k1" version = "0.5.6" source = "git+https://github.com/ethcore/rust-secp256k1#98ad9b9ecae44a563efdd64273bcebc6b4ed81c6" dependencies = [ - "arrayvec 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", + "arrayvec 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)", "gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", @@ -394,6 +395,7 @@ dependencies = [ "ethcore-ipc 1.7.0", "ethcore-ipc-codegen 1.7.0", "ethcore-ipc-nano 1.7.0", + "ethcore-logger 1.7.0", "ethcore-stratum 1.7.0", "ethcore-util 1.7.0", "ethjson 0.1.0", @@ -570,11 +572,13 @@ dependencies = [ name = "ethcore-logger" version = "1.7.0" dependencies = [ + "ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "arrayvec 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "ethcore-util 1.7.0", "isatty 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "regex 0.1.68 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -583,10 +587,11 @@ dependencies = [ name = "ethcore-network" version = "1.7.0" dependencies = [ - "ansi_term 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "ethcore-devtools 1.7.0", "ethcore-io 1.7.0", + "ethcore-logger 1.7.0", "ethcore-util 1.7.0", "ethcrypto 0.1.0", "ethkey 0.2.0", @@ -595,6 +600,7 @@ dependencies = [ "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.1 (git+https://github.com/ethcore/mio)", "parking_lot 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "path 0.1.0", "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "rlp 0.1.0", "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", @@ -615,6 +621,7 @@ dependencies = [ "ethcore-io 1.7.0", "ethcore-ipc 1.7.0", "ethcore-light 1.7.0", + "ethcore-logger 1.7.0", "ethcore-util 1.7.0", "ethcrypto 0.1.0", "ethjson 0.1.0", @@ -687,6 +694,7 @@ dependencies = [ "ethcore-ipc 1.7.0", "ethcore-ipc-codegen 1.7.0", "ethcore-ipc-nano 1.7.0", + "ethcore-logger 1.7.0", "ethcore-util 1.7.0", "futures 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-core 6.0.0 (git+https://github.com/ethcore/jsonrpc.git?branch=parity-1.6)", @@ -703,8 +711,7 @@ dependencies = [ name = "ethcore-util" version = "1.7.0" dependencies = [ - "ansi_term 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", - "arrayvec 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", + "ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "elastic-array 0.6.0 (git+https://github.com/ethcore/elastic-array)", "env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -712,9 +719,9 @@ dependencies = [ "ethcore-bigint 0.1.2", "ethcore-bloom-journal 0.1.0", "ethcore-devtools 1.7.0", + "ethcore-logger 1.7.0", "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "lru-cache 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1457,7 +1464,7 @@ dependencies = [ [[package]] name = "nodrop" -version = "0.1.6" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "odds 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1719,6 +1726,7 @@ dependencies = [ "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-hash-fetch 1.7.0", "parity-reactor 0.1.0", + "path 0.1.0", "target_info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1743,6 +1751,10 @@ dependencies = [ "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "path" +version = "0.1.0" + [[package]] name = "phf" version = "0.7.14" @@ -2601,10 +2613,10 @@ dependencies = [ [metadata] "checksum advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e06588080cb19d0acb6739808aafa5f26bfb2ca015b2b6370028b44cf7cb8a9a" "checksum aho-corasick 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "67077478f0a03952bed2e6786338d400d40c25e9836e08ad50af96607317fd03" -"checksum ansi_term 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1f46cd5b1d660c938e3f92dfe7a73d832b3281479363dd0cd9c1c2fbf60f7962" +"checksum ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "23ac7c30002a5accbf7e8987d0632fa6de155b7c3d39d0067317a391e00a2ef6" "checksum antidote 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "34fde25430d87a9388dadbe6e34d7f72a462c8b43ac8d309b42b0a8505d7e2a5" "checksum app_dirs 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b7d1c0d48a81bbb13043847f957971f4d87c81542d80ece5e84ba3cba4058fd4" -"checksum arrayvec 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)" = "16e3bdb2f54b3ace0285975d59a97cf8ed3855294b2b6bc651fcf22a9c352975" +"checksum arrayvec 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)" = "d89f1b0e242270b5b797778af0c8d182a1a2ccac5d8d6fadf414223cc0fab096" "checksum aster 0.41.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ccfdf7355d9db158df68f976ed030ab0f6578af811f5a7bb6dcf221ec24e0e0" "checksum base-x 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2f59103b47307f76e03bef1633aec7fa9e29bfb5aa6daf5a334f94233c71f6c1" "checksum base32 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1b9605ba46d61df0410d8ac686b0007add8172eba90e8e909c347856fe794d8c" @@ -2699,7 +2711,7 @@ dependencies = [ "checksum nix 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f05c2fc965fc1cd6b73fa57fa7b89f288178737f2f3ce9e63e4a6a141189000e" "checksum nix 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a7bb1da2be7da3cbffda73fc681d509ffd9e665af478d2bee1907cee0bc64b2" "checksum nix 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a0d95c5fa8b641c10ad0b8887454ebaafa3c92b5cd5350f8fc693adafd178e7b" -"checksum nodrop 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "4d9a22dbcebdeef7bf275cbf444d6521d4e7a2fee187b72d80dba0817120dd8f" +"checksum nodrop 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "52cd74cd09beba596430cc6e3091b74007169a56246e1262f0ba451ea95117b2" "checksum nom 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6caab12c5f97aa316cb249725aa32115118e1522b445e26c257dd77cad5ffd4e" "checksum num 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)" = "c04bd954dbf96f76bab6e5bd6cef6f1ce1262d15268ce4f926d2b5b778fa7af2" "checksum num-bigint 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)" = "41655c8d667be847a0b72fe0888857a7b3f052f691cf40852be5fcf87b274a65" diff --git a/Cargo.toml b/Cargo.toml index 099be68e5..f62f8b42f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,7 @@ num_cpus = "1.2" number_prefix = "0.2" rpassword = "0.2.1" semver = "0.5" -ansi_term = "0.7" +ansi_term = "0.9" regex = "0.1" isatty = "0.1" toml = "0.2" @@ -50,6 +50,7 @@ parity-updater = { path = "updater" } parity-reactor = { path = "util/reactor" } parity-local-store = { path = "local-store" } ethcore-dapps = { path = "dapps", optional = true } +path = { path = "util/path" } clippy = { version = "0.0.103", optional = true} ethcore-secretstore = { path = "secret_store", optional = true } diff --git a/ethcore/Cargo.toml b/ethcore/Cargo.toml index d1c9d624b..17f79840e 100644 --- a/ethcore/Cargo.toml +++ b/ethcore/Cargo.toml @@ -43,6 +43,7 @@ rlp = { path = "../util/rlp" } ethcore-stratum = { path = "../stratum" } ethcore-bloom-journal = { path = "../util/bloom" } hardware-wallet = { path = "../hw" } +ethcore-logger = { path = "../logger" } stats = { path = "../util/stats" } num = "0.1" diff --git a/ethcore/src/json_tests/chain.rs b/ethcore/src/json_tests/chain.rs index 221fa1aba..987280bc1 100644 --- a/ethcore/src/json_tests/chain.rs +++ b/ethcore/src/json_tests/chain.rs @@ -25,7 +25,7 @@ use miner::Miner; use io::IoChannel; pub fn json_chain_test(json_data: &[u8], era: ChainEra) -> Vec { - init_log(); + ::ethcore_logger::init_log(); let tests = ethjson::blockchain::Test::load(json_data).unwrap(); let mut failed = Vec::new(); diff --git a/ethcore/src/json_tests/state.rs b/ethcore/src/json_tests/state.rs index 5a6b1ccd0..6388daf94 100644 --- a/ethcore/src/json_tests/state.rs +++ b/ethcore/src/json_tests/state.rs @@ -22,7 +22,7 @@ use ethereum; use ethjson; pub fn json_chain_test(json_data: &[u8], era: ChainEra) -> Vec { - init_log(); + ::ethcore_logger::init_log(); let tests = ethjson::state::Test::load(json_data).unwrap(); let mut failed = Vec::new(); let engine = match era { diff --git a/ethcore/src/lib.rs b/ethcore/src/lib.rs index 75c8a80e1..df0738997 100644 --- a/ethcore/src/lib.rs +++ b/ethcore/src/lib.rs @@ -106,6 +106,7 @@ extern crate ethcore_stratum; extern crate ethabi; extern crate hardware_wallet; extern crate stats; +extern crate ethcore_logger; extern crate num; #[macro_use] diff --git a/ethcore/src/miner/price_info.rs b/ethcore/src/miner/price_info.rs index 4cc6fb36b..29994afb4 100644 --- a/ethcore/src/miner/price_info.rs +++ b/ethcore/src/miner/price_info.rs @@ -110,7 +110,7 @@ impl PriceInfo { fn should_get_price_info() { use std::sync::Arc; use std::time::Duration; - use util::log::init_log; + use ethcore_logger::init_log; use util::{Condvar, Mutex}; init_log(); diff --git a/ethcore/src/miner/transaction_queue.rs b/ethcore/src/miner/transaction_queue.rs index 9a3e6af1a..81c944e4d 100644 --- a/ethcore/src/miner/transaction_queue.rs +++ b/ethcore/src/miner/transaction_queue.rs @@ -2454,6 +2454,7 @@ pub mod test { #[test] fn should_replace_same_transaction_when_has_higher_fee() { + use ethcore_logger::init_log; init_log(); // given let mut txq = TransactionQueue::default(); diff --git a/ethcore/src/state/mod.rs b/ethcore/src/state/mod.rs index c34f43041..6e2a956ab 100644 --- a/ethcore/src/state/mod.rs +++ b/ethcore/src/state/mod.rs @@ -946,7 +946,7 @@ mod tests { use env_info::EnvInfo; use spec::*; use transaction::*; - use util::log::init_log; + use ethcore_logger::init_log; use trace::{FlatTrace, TraceError, trace}; use types::executed::CallType; diff --git a/ethcore/src/state_db.rs b/ethcore/src/state_db.rs index bfd1068ca..2831d2f9b 100644 --- a/ethcore/src/state_db.rs +++ b/ethcore/src/state_db.rs @@ -457,7 +457,7 @@ mod tests { use util::{U256, H256, Address, DBTransaction}; use tests::helpers::*; use state::{Account, Backend}; - use util::log::init_log; + use ethcore_logger::init_log; #[test] fn state_db_smoke() { diff --git a/logger/Cargo.toml b/logger/Cargo.toml index e0004cd48..b505355c8 100644 --- a/logger/Cargo.toml +++ b/logger/Cargo.toml @@ -8,11 +8,13 @@ authors = ["Parity Technologies "] [dependencies] log = "0.3" env_logger = "0.3" -ethcore-util = { path = "../util" } isatty = "0.1" lazy_static = "0.2" regex = "0.1" time = "0.1" +parking_lot = "0.3" +arrayvec = "0.3" +ansi_term = "0.9" [profile.release] debug = true diff --git a/logger/src/lib.rs b/logger/src/lib.rs index f9188d928..b492f4f78 100644 --- a/logger/src/lib.rs +++ b/logger/src/lib.rs @@ -16,7 +16,7 @@ //! Logger for parity executables -extern crate ethcore_util as util; +extern crate arrayvec; extern crate log as rlog; extern crate isatty; extern crate regex; @@ -24,6 +24,10 @@ 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}; @@ -31,8 +35,10 @@ use std::io::Write; use isatty::{stderr_isatty, stdout_isatty}; use env_logger::LogBuilder; use regex::Regex; -use util::{Mutex, RotatingLogger} ; -use util::log::Colour; +use ansi_term::Colour; +use parking_lot::Mutex; + +pub use rotating::{RotatingLogger, init_log}; #[derive(Debug, PartialEq, Clone)] pub struct Config { diff --git a/util/src/log.rs b/logger/src/rotating.rs similarity index 98% rename from util/src/log.rs rename to logger/src/rotating.rs index 4e537603d..2d98ebcd0 100644 --- a/util/src/log.rs +++ b/logger/src/rotating.rs @@ -20,7 +20,6 @@ use std::env; use rlog::LogLevelFilter; use env_logger::LogBuilder; use arrayvec::ArrayVec; -pub use ansi_term::{Colour, Style}; use parking_lot::{RwLock, RwLockReadGuard}; diff --git a/parity/configuration.rs b/parity/configuration.rs index 9b491143d..a9a9159e1 100644 --- a/parity/configuration.rs +++ b/parity/configuration.rs @@ -22,7 +22,7 @@ use std::cmp::max; use cli::{Args, ArgsError}; use util::{Hashable, H256, U256, Uint, Bytes, version_data, Address}; use util::journaldb::Algorithm; -use util::log::Colour; +use util::Colour; use ethsync::{NetworkConfiguration, is_valid_node_url, AllowIP}; use ethcore::ethstore::ethkey::Secret; use ethcore::client::{VMType}; @@ -824,7 +824,7 @@ impl Configuration { } fn directories(&self) -> Directories { - use util::path; + use path; let local_path = default_local_path(); let base_path = self.args.flag_base_path.as_ref().map_or_else(|| default_data_path(), |s| s.clone()); diff --git a/parity/helpers.rs b/parity/helpers.rs index d691aabc6..e98c31ab7 100644 --- a/parity/helpers.rs +++ b/parity/helpers.rs @@ -18,7 +18,7 @@ use std::{io, env}; use std::io::{Write, BufReader, BufRead}; use std::time::Duration; use std::fs::File; -use util::{clean_0x, U256, Uint, Address, path, CompactionProfile}; +use util::{clean_0x, U256, Uint, Address, CompactionProfile}; use util::journaldb::Algorithm; use ethcore::client::{Mode, BlockId, VMType, DatabaseCompactionProfile, ClientConfig, VerifierType}; use ethcore::miner::{PendingSet, GasLimit, PrioritizationStrategy}; @@ -27,6 +27,7 @@ use dir::DatabaseDirectories; use upgrade::{upgrade, upgrade_data_paths}; use migration::migrate; use ethsync::is_valid_node_url; +use path; pub fn to_duration(s: &str) -> Result { to_seconds(s).map(Duration::from_secs) @@ -465,7 +466,7 @@ but the first password is trimmed #[test] #[cfg(not(windows))] fn test_geth_ipc_path() { - use util::path; + use path; assert_eq!(geth_ipc_path(true), path::ethereum::with_testnet("geth.ipc").to_str().unwrap().to_owned()); assert_eq!(geth_ipc_path(false), path::ethereum::with_default("geth.ipc").to_str().unwrap().to_owned()); } diff --git a/parity/main.rs b/parity/main.rs index 7d22be1c3..3e499d483 100644 --- a/parity/main.rs +++ b/parity/main.rs @@ -61,6 +61,7 @@ extern crate parity_reactor; extern crate parity_updater as updater; extern crate parity_local_store as local_store; extern crate rpc_cli; +extern crate path; #[macro_use] extern crate log as rlog; diff --git a/parity/rpc_apis.rs b/parity/rpc_apis.rs index 469245c19..cc45e3f8b 100644 --- a/parity/rpc_apis.rs +++ b/parity/rpc_apis.rs @@ -33,7 +33,7 @@ use ethsync::{ManageNetwork, SyncProvider}; use hash_fetch::fetch::Client as FetchClient; use jsonrpc_core::{MetaIoHandler}; use updater::Updater; -use util::RotatingLogger; +use ethcore_logger::RotatingLogger; #[derive(Debug, PartialEq, Clone, Eq, Hash)] pub enum Api { diff --git a/parity/run.rs b/parity/run.rs index b3313c16e..f781a8774 100644 --- a/parity/run.rs +++ b/parity/run.rs @@ -20,9 +20,9 @@ use ctrlc::CtrlC; use fdlimit::raise_fd_limit; use ethcore_rpc::{NetworkSettings, informant, is_major_importing}; use ethsync::NetworkConfiguration; -use util::{Colour, version, RotatingLogger, Mutex, Condvar}; +use util::{Colour, version, Mutex, Condvar}; use io::{MayPanic, ForwardPanic, PanicHandler}; -use ethcore_logger::{Config as LogConfig}; +use ethcore_logger::{Config as LogConfig, RotatingLogger}; use ethcore::miner::{StratumOptions, Stratum}; use ethcore::client::{Client, Mode, DatabaseCompactionProfile, VMType, BlockChainClient}; use ethcore::service::ClientService; diff --git a/parity/signer.rs b/parity/signer.rs index 346276496..d69670204 100644 --- a/parity/signer.rs +++ b/parity/signer.rs @@ -29,7 +29,7 @@ use helpers::replace_home; use io::{ForwardPanic, PanicHandler}; use jsonrpc_core::reactor::{RpcHandler, Remote}; use rpc_apis; -use util::path::restrict_permissions_owner; +use path::restrict_permissions_owner; use util::H256; const CODES_FILENAME: &'static str = "authcodes"; diff --git a/rpc/Cargo.toml b/rpc/Cargo.toml index 0b3cc4b82..d18393902 100644 --- a/rpc/Cargo.toml +++ b/rpc/Cargo.toml @@ -34,6 +34,7 @@ ethsync = { path = "../sync" } ethjson = { path = "../json" } ethcore-devtools = { path = "../devtools" } ethcore-light = { path = "../ethcore/light" } +ethcore-logger = { path = "../logger" } parity-updater = { path = "../updater" } rlp = { path = "../util/rlp" } fetch = { path = "../util/fetch" } diff --git a/rpc/src/lib.rs b/rpc/src/lib.rs index 201f41c22..a00b138ac 100644 --- a/rpc/src/lib.rs +++ b/rpc/src/lib.rs @@ -34,6 +34,7 @@ extern crate ethstore; extern crate ethsync; extern crate ethash; extern crate ethcore_light as light; +extern crate ethcore_logger; extern crate transient_hashmap; extern crate jsonrpc_ipc_server as ipc; extern crate ethcore_ipc; diff --git a/rpc/src/v1/impls/light/parity.rs b/rpc/src/v1/impls/light/parity.rs index 49421fd04..545935417 100644 --- a/rpc/src/v1/impls/light/parity.rs +++ b/rpc/src/v1/impls/light/parity.rs @@ -19,7 +19,7 @@ use std::sync::Arc; use std::collections::{BTreeMap, HashSet}; use futures::{future, Future, BoxFuture}; -use util::RotatingLogger; +use ethcore_logger::RotatingLogger; use util::misc::version_data; use crypto::ecies; diff --git a/rpc/src/v1/impls/parity.rs b/rpc/src/v1/impls/parity.rs index aee4dc3fd..2a7f85aa3 100644 --- a/rpc/src/v1/impls/parity.rs +++ b/rpc/src/v1/impls/parity.rs @@ -20,7 +20,8 @@ use std::str::FromStr; use std::collections::{BTreeMap, HashSet}; use futures::{future, Future, BoxFuture}; -use util::{RotatingLogger, Address}; +use ethcore_logger::RotatingLogger; +use util::Address; use util::misc::version_data; use crypto::ecies; diff --git a/rpc/src/v1/tests/mocked/parity.rs b/rpc/src/v1/tests/mocked/parity.rs index 59cde8594..8acedc2d4 100644 --- a/rpc/src/v1/tests/mocked/parity.rs +++ b/rpc/src/v1/tests/mocked/parity.rs @@ -15,7 +15,7 @@ // along with Parity. If not, see . use std::sync::Arc; -use util::log::RotatingLogger; +use ethcore_logger::RotatingLogger; use util::Address; use ethsync::ManageNetwork; use ethcore::account_provider::AccountProvider; diff --git a/rpc/src/v1/types/confirmations.rs b/rpc/src/v1/types/confirmations.rs index dd44e5750..f749df449 100644 --- a/rpc/src/v1/types/confirmations.rs +++ b/rpc/src/v1/types/confirmations.rs @@ -18,7 +18,7 @@ use std::fmt; use serde::{Serialize, Serializer}; -use util::log::Colour; +use util::Colour; use util::bytes::ToPretty; use v1::types::{U256, TransactionRequest, RichRawTransaction, H160, H256, H520, Bytes, TransactionCondition, Origin}; diff --git a/rpc/src/v1/types/transaction_request.rs b/rpc/src/v1/types/transaction_request.rs index 5839a0de8..242c02360 100644 --- a/rpc/src/v1/types/transaction_request.rs +++ b/rpc/src/v1/types/transaction_request.rs @@ -18,7 +18,7 @@ use v1::types::{Bytes, H160, U256, TransactionCondition}; use v1::helpers; -use util::log::Colour; +use util::Colour; use std::fmt; diff --git a/stratum/Cargo.toml b/stratum/Cargo.toml index 1b309985a..df984bef1 100644 --- a/stratum/Cargo.toml +++ b/stratum/Cargo.toml @@ -24,6 +24,7 @@ semver = "0.5" ethcore-ipc-nano = { path = "../ipc/nano" } futures = "0.1" tokio-core = "0.1" +ethcore-logger = { path = "../logger" } [profile.release] debug = true diff --git a/stratum/src/lib.rs b/stratum/src/lib.rs index 59964773c..5a7d50613 100644 --- a/stratum/src/lib.rs +++ b/stratum/src/lib.rs @@ -24,6 +24,7 @@ extern crate ethcore_util as util; extern crate ethcore_ipc as ipc; extern crate semver; extern crate futures; +extern crate ethcore_logger; #[cfg(test)] extern crate tokio_core; extern crate ethcore_devtools as devtools; @@ -323,6 +324,8 @@ mod tests { use tokio_core::io; use futures::{Future, future}; + use ethcore_logger::init_log; + pub struct VoidManager; impl JobDispatcher for VoidManager { @@ -331,32 +334,6 @@ mod tests { } } - lazy_static! { - static ref LOG_DUMMY: bool = { - use log::LogLevelFilter; - use env_logger::LogBuilder; - use std::env; - - let mut builder = LogBuilder::new(); - builder.filter(None, LogLevelFilter::Info); - - if let Ok(log) = env::var("RUST_LOG") { - builder.parse(&log); - } - - if let Ok(_) = builder.init() { - println!("logger initialized"); - } - true - }; - } - - /// Intialize log with default settings - #[cfg(test)] - fn init_log() { - let _ = *LOG_DUMMY; - } - fn dummy_request(addr: &SocketAddr, data: &str) -> Vec { let mut core = Core::new().expect("Tokio Core should be created with no errors"); let mut buffer = vec![0u8; 2048]; diff --git a/updater/Cargo.toml b/updater/Cargo.toml index c0738cc59..53088d030 100644 --- a/updater/Cargo.toml +++ b/updater/Cargo.toml @@ -20,6 +20,7 @@ parity-hash-fetch = { path = "../hash-fetch" } ipc-common-types = { path = "../ipc-common-types" } ethcore-ipc = { path = "../ipc/rpc" } parity-reactor = { path = "../util/reactor" } +path = { path = "../util/path" } [profile.release] debug = true diff --git a/updater/src/lib.rs b/updater/src/lib.rs index 7d7146d7e..730af956d 100644 --- a/updater/src/lib.rs +++ b/updater/src/lib.rs @@ -26,6 +26,7 @@ extern crate ethsync; extern crate ethcore_ipc as ipc; extern crate target_info; extern crate parity_reactor; +extern crate path; mod updater; mod operations; diff --git a/updater/src/updater.rs b/updater/src/updater.rs index c2bc98273..5a4e2e1c9 100644 --- a/updater/src/updater.rs +++ b/updater/src/updater.rs @@ -21,7 +21,7 @@ use std::path::{PathBuf}; use target_info::Target; use util::misc; use ipc_common_types::{VersionInfo, ReleaseTrack}; -use util::path::restrict_permissions_owner; +use path::restrict_permissions_owner; use util::{Address, H160, H256, Mutex, Bytes}; use ethsync::{SyncProvider}; use ethcore::client::{BlockId, BlockChainClient, ChainNotify}; diff --git a/util/Cargo.toml b/util/Cargo.toml index d32d2519a..df34ccbfb 100644 --- a/util/Cargo.toml +++ b/util/Cargo.toml @@ -11,11 +11,9 @@ build = "build.rs" log = "0.3" env_logger = "0.3" rustc-serialize = "0.3" -arrayvec = "0.3" rand = "0.3.12" time = "0.1.34" rocksdb = { git = "https://github.com/ethcore/rust-rocksdb" } -lazy_static = "0.2" eth-secp256k1 = { git = "https://github.com/ethcore/rust-secp256k1" } rust-crypto = "0.2.34" elastic-array = { git = "https://github.com/ethcore/elastic-array" } @@ -32,11 +30,12 @@ ethcore-bigint = { path = "bigint" } parking_lot = "0.3" using_queue = { path = "using_queue" } table = { path = "table" } -ansi_term = "0.7" +ansi_term = "0.9" tiny-keccak= "1.0" ethcore-bloom-journal = { path = "bloom" } regex = "0.1" lru-cache = "0.1.0" +ethcore-logger = { path = "../logger" } [features] default = [] diff --git a/util/network/Cargo.toml b/util/network/Cargo.toml index 7fced467a..2f1ac81d3 100644 --- a/util/network/Cargo.toml +++ b/util/network/Cargo.toml @@ -19,7 +19,7 @@ clippy = { version = "0.0.103", optional = true} igd = "0.5.0" libc = "0.2.7" parking_lot = "0.3" -ansi_term = "0.7" +ansi_term = "0.9" rustc-serialize = "0.3" ethcore-io = { path = "../io" } ethcore-util = { path = ".." } @@ -27,6 +27,8 @@ ethcore-devtools = { path = "../../devtools" } ethkey = { path = "../../ethkey" } ethcrypto = { path = "../../ethcrypto" } rlp = { path = "../rlp" } +path = { path = "../path" } +ethcore-logger = { path ="../../logger" } [features] default = [] diff --git a/util/network/src/host.rs b/util/network/src/host.rs index b64301369..bb4b4fb1e 100644 --- a/util/network/src/host.rs +++ b/util/network/src/host.rs @@ -40,7 +40,7 @@ use node_table::*; use stats::NetworkStats; use discovery::{Discovery, TableUpdates, NodeEntry}; use ip_utils::{map_external_address, select_public_address}; -use util::path::restrict_permissions_owner; +use path::restrict_permissions_owner; use parking_lot::{Mutex, RwLock}; type Slab = ::slab::Slab; diff --git a/util/network/src/lib.rs b/util/network/src/lib.rs index 862200fa3..c4cc524f4 100644 --- a/util/network/src/lib.rs +++ b/util/network/src/lib.rs @@ -71,6 +71,8 @@ extern crate ethkey; extern crate ethcrypto as crypto; extern crate rlp; extern crate bytes; +extern crate path; +extern crate ethcore_logger; #[macro_use] extern crate log; diff --git a/util/network/src/tests.rs b/util/network/src/tests.rs index fba8f6eb4..692dd94a0 100644 --- a/util/network/src/tests.rs +++ b/util/network/src/tests.rs @@ -98,7 +98,7 @@ fn net_service() { #[test] fn net_connect() { - ::util::log::init_log(); + ::ethcore_logger::init_log(); let key1 = Random.generate().unwrap(); let mut config1 = NetworkConfiguration::new_local(); config1.use_secret = Some(key1.secret().clone()); diff --git a/util/path/Cargo.toml b/util/path/Cargo.toml new file mode 100644 index 000000000..7df3917b1 --- /dev/null +++ b/util/path/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "path" +version = "0.1.0" +authors = ["debris "] + +[dependencies] diff --git a/util/src/path.rs b/util/path/src/lib.rs similarity index 100% rename from util/src/path.rs rename to util/path/src/lib.rs diff --git a/util/src/journaldb/earlymergedb.rs b/util/src/journaldb/earlymergedb.rs index f484a623a..bd05d5fc1 100644 --- a/util/src/journaldb/earlymergedb.rs +++ b/util/src/journaldb/earlymergedb.rs @@ -553,7 +553,7 @@ mod tests { use hashdb::{HashDB, DBValue}; use super::*; use super::super::traits::JournalDB; - use log::init_log; + use ethcore_logger::init_log; use kvdb::{DatabaseConfig}; #[test] diff --git a/util/src/journaldb/overlayrecentdb.rs b/util/src/journaldb/overlayrecentdb.rs index 90f7acfcf..e8095e71e 100644 --- a/util/src/journaldb/overlayrecentdb.rs +++ b/util/src/journaldb/overlayrecentdb.rs @@ -456,7 +456,7 @@ mod tests { use common::*; use super::*; use hashdb::{HashDB, DBValue}; - use log::init_log; + use ethcore_logger::init_log; use journaldb::JournalDB; use kvdb::Database; diff --git a/util/src/lib.rs b/util/src/lib.rs index 4e46dbc24..93e03c8b1 100644 --- a/util/src/lib.rs +++ b/util/src/lib.rs @@ -93,7 +93,6 @@ extern crate rocksdb; extern crate env_logger; extern crate crypto as rcrypto; extern crate secp256k1; -extern crate arrayvec; extern crate elastic_array; extern crate time; extern crate ethcore_devtools as devtools; @@ -108,9 +107,8 @@ extern crate regex; extern crate lru_cache; extern crate heapsize; extern crate itertools; +extern crate ethcore_logger; -#[macro_use] -extern crate lazy_static; #[macro_use] extern crate log as rlog; @@ -137,8 +135,6 @@ pub mod trie; pub mod nibbleslice; pub mod nibblevec; pub mod semantic_version; -pub mod log; -pub mod path; pub mod snappy; pub mod cache; mod timer; @@ -153,9 +149,9 @@ pub use triehash::*; pub use trie::{Trie, TrieMut, TrieDB, TrieDBMut, TrieFactory, TrieError, SecTrieDB, SecTrieDBMut}; pub use nibbleslice::*; pub use semantic_version::*; -pub use log::*; pub use kvdb::*; pub use timer::*; +pub use ansi_term::{Colour, Style}; /// 160-bit integer representing account address pub type Address = H160; diff --git a/util/src/trie/triedbmut.rs b/util/src/trie/triedbmut.rs index 10d7f3aa6..c5f2a739b 100644 --- a/util/src/trie/triedbmut.rs +++ b/util/src/trie/triedbmut.rs @@ -958,7 +958,7 @@ mod tests { #[test] fn playpen() { - ::log::init_log(); + ::ethcore_logger::init_log(); let mut seed = H256::new(); for test_i in 0..10 {