Coloured, padding logging. (#1133)
* Add info message for mined block. * Coloured, padding logging. * Remove superfluous logs. * Use better term colour module.
This commit is contained in:
parent
2969d015ed
commit
27380cdadb
6
Cargo.lock
generated
6
Cargo.lock
generated
@ -2,6 +2,7 @@
|
||||
name = "parity"
|
||||
version = "1.2.0"
|
||||
dependencies = [
|
||||
"ansi_term 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"clippy 0.0.67 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ctrlc 1.1.1 (git+https://github.com/ethcore/rust-ctrlc.git)",
|
||||
"daemonize 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -39,6 +40,11 @@ dependencies = [
|
||||
"memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ansi_term"
|
||||
version = "0.7.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "arrayvec"
|
||||
version = "0.3.16"
|
||||
|
@ -33,8 +33,9 @@ ethcore-rpc = { path = "rpc", optional = true }
|
||||
ethcore-webapp = { path = "webapp", optional = true }
|
||||
semver = "0.2"
|
||||
ethcore-ipc-nano = { path = "ipc/nano" }
|
||||
"ethcore-ipc" = { path = "ipc/rpc" }
|
||||
ethcore-ipc = { path = "ipc/rpc" }
|
||||
json-ipc-server = { git = "https://github.com/ethcore/json-ipc-server.git" }
|
||||
ansi_term = "0.7"
|
||||
|
||||
[dependencies.hyper]
|
||||
version = "0.8"
|
||||
|
@ -14,9 +14,13 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
extern crate ansi_term;
|
||||
|
||||
use std::sync::RwLock;
|
||||
use std::ops::{Deref, DerefMut};
|
||||
use ansi_term::Colour::*;
|
||||
use ethsync::{EthSync, SyncProvider};
|
||||
use util::Uint;
|
||||
use ethcore::client::*;
|
||||
use number_prefix::{binary_prefix, Standalone, Prefixed};
|
||||
|
||||
@ -61,23 +65,25 @@ impl Informant {
|
||||
self.cache_info.read().unwrap().deref(),
|
||||
write_report.deref()
|
||||
) {
|
||||
println!("[ #{} {} ]---[ {} blk/s | {} tx/s | {} gas/s //··· {}/{} peers, #{}, {}+{} queued ···// mem: {} db, {} chain, {} queue, {} sync ]",
|
||||
chain_info.best_block_number,
|
||||
chain_info.best_block_hash,
|
||||
(report.blocks_imported - last_report.blocks_imported) / dur,
|
||||
(report.transactions_applied - last_report.transactions_applied) / dur,
|
||||
(report.gas_processed - last_report.gas_processed) / From::from(dur),
|
||||
println!("#{} {} {} blk/s {} tx/s {} Kgas/s {}/{} peers #{} {}+{} Qed {} db {} chain {} queue {} sync",
|
||||
White.bold().paint(format!("{:<7}", chain_info.best_block_number)),
|
||||
White.bold().paint(format!("{}", chain_info.best_block_hash)),
|
||||
|
||||
sync_info.num_active_peers,
|
||||
sync_info.num_peers,
|
||||
sync_info.last_imported_block_number.unwrap_or(chain_info.best_block_number),
|
||||
queue_info.unverified_queue_size,
|
||||
queue_info.verified_queue_size,
|
||||
Yellow.bold().paint(format!("{:3}", (report.blocks_imported - last_report.blocks_imported) / dur)),
|
||||
Yellow.bold().paint(format!("{:3}", (report.transactions_applied - last_report.transactions_applied) / dur)),
|
||||
Yellow.bold().paint(format!("{:4}", ((report.gas_processed - last_report.gas_processed) / From::from(dur * 1000)).low_u64())),
|
||||
|
||||
Informant::format_bytes(report.state_db_mem),
|
||||
Informant::format_bytes(cache_info.total()),
|
||||
Informant::format_bytes(queue_info.mem_used),
|
||||
Informant::format_bytes(sync_info.mem_used),
|
||||
Green.bold().paint(format!("{:2}", sync_info.num_active_peers)),
|
||||
Green.bold().paint(format!("{:2}", sync_info.num_peers)),
|
||||
|
||||
Cyan.bold().paint(format!("{:<7}", sync_info.last_imported_block_number.unwrap_or(chain_info.best_block_number))),
|
||||
Blue.bold().paint(format!("{:4}", queue_info.unverified_queue_size)),
|
||||
Blue.bold().paint(format!("{:4}", queue_info.verified_queue_size)),
|
||||
|
||||
Purple.bold().paint(format!("{:>8}", Informant::format_bytes(report.state_db_mem))),
|
||||
Purple.bold().paint(format!("{:>8}", Informant::format_bytes(cache_info.total()))),
|
||||
Purple.bold().paint(format!("{:>8}", Informant::format_bytes(queue_info.mem_used))),
|
||||
Purple.bold().paint(format!("{:>8}", Informant::format_bytes(sync_info.mem_used))),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
#![cfg_attr(feature="dev", allow(useless_format))]
|
||||
|
||||
extern crate docopt;
|
||||
extern crate ansi_term;
|
||||
extern crate num_cpus;
|
||||
extern crate rustc_serialize;
|
||||
extern crate ethcore_util as util;
|
||||
|
Loading…
Reference in New Issue
Block a user