diff --git a/Cargo.lock b/Cargo.lock
index d13c45afa22f7..07a122699e912 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -425,11 +425,13 @@ dependencies = [
name = "browser-utils"
version = "0.8.0"
dependencies = [
+ "chrono",
"clear_on_drop",
"console_error_panic_hook",
"console_log",
"futures 0.1.29",
"futures 0.3.4",
+ "futures-timer 3.0.1",
"js-sys",
"kvdb-web",
"libp2p",
@@ -437,6 +439,7 @@ dependencies = [
"rand 0.6.5",
"rand 0.7.3",
"sc-chain-spec",
+ "sc-informant",
"sc-network",
"sc-service",
"wasm-bindgen",
@@ -595,10 +598,12 @@ version = "0.4.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "31850b4a4d6bae316f7a09e691c944c28299298837edc0a03f755618c23cbc01"
dependencies = [
+ "js-sys",
"num-integer",
"num-traits",
"serde",
"time",
+ "wasm-bindgen",
]
[[package]]
@@ -1717,20 +1722,19 @@ checksum = "7b0a34e53cf6cdcd0178aa573aed466b646eb3db769570841fda0c7ede375a27"
[[package]]
name = "futures-timer"
-version = "0.4.0"
+version = "2.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "878f1d2fc31355fa02ed2372e741b0c17e58373341e6a122569b4623a14a7d33"
-dependencies = [
- "futures-core-preview",
- "futures-util-preview",
- "pin-utils",
-]
+checksum = "a1de7508b218029b0f01662ed8f61b1c964b3ae99d6f25462d0f55a595109df6"
[[package]]
name = "futures-timer"
-version = "2.0.2"
+version = "3.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a1de7508b218029b0f01662ed8f61b1c964b3ae99d6f25462d0f55a595109df6"
+checksum = "3de1a2b2a2a33d9e60e17980b60ee061eeaae96a5abe9121db0fdb9af167a1c5"
+dependencies = [
+ "gloo-timers",
+ "send_wrapper 0.4.0",
+]
[[package]]
name = "futures-util"
@@ -1873,6 +1877,19 @@ dependencies = [
"regex",
]
+[[package]]
+name = "gloo-timers"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0b2d17dbd803c2fc86cb1b613adf63192046a7176f383a8302594654752c4c4a"
+dependencies = [
+ "futures-channel",
+ "futures-core",
+ "js-sys",
+ "wasm-bindgen",
+ "web-sys",
+]
+
[[package]]
name = "goblin"
version = "0.1.3"
@@ -1891,7 +1908,7 @@ dependencies = [
"async-std",
"chrono",
"derive_more",
- "futures-timer 2.0.2",
+ "futures-timer 3.0.1",
"futures-util",
"hyper 0.13.2",
"lazy_static",
@@ -1907,7 +1924,7 @@ name = "grafana-data-source-test"
version = "2.0.0"
dependencies = [
"futures 0.3.4",
- "futures-timer 2.0.2",
+ "futures-timer 3.0.1",
"grafana-data-source",
"rand 0.7.3",
]
@@ -5450,7 +5467,7 @@ dependencies = [
"derive_more",
"env_logger 0.7.1",
"futures 0.3.4",
- "futures-timer 2.0.2",
+ "futures-timer 3.0.1",
"libp2p",
"log 0.4.8",
"parity-scale-codec",
@@ -5554,6 +5571,7 @@ dependencies = [
"regex",
"rpassword",
"sc-client-api",
+ "sc-informant",
"sc-network",
"sc-service",
"sc-telemetry",
@@ -5677,7 +5695,7 @@ dependencies = [
"env_logger 0.7.1",
"futures 0.1.29",
"futures 0.3.4",
- "futures-timer 0.4.0",
+ "futures-timer 3.0.1",
"log 0.4.8",
"parity-scale-codec",
"parking_lot 0.10.0",
@@ -5717,7 +5735,7 @@ dependencies = [
"fork-tree",
"futures 0.1.29",
"futures 0.3.4",
- "futures-timer 0.4.0",
+ "futures-timer 3.0.1",
"log 0.4.8",
"merlin",
"num-bigint",
@@ -5823,7 +5841,7 @@ name = "sc-consensus-slots"
version = "0.8.0"
dependencies = [
"futures 0.3.4",
- "futures-timer 2.0.2",
+ "futures-timer 3.0.1",
"log 0.4.8",
"parity-scale-codec",
"parking_lot 0.10.0",
@@ -5949,7 +5967,7 @@ dependencies = [
"fork-tree",
"futures 0.1.29",
"futures 0.3.4",
- "futures-timer 2.0.2",
+ "futures-timer 3.0.1",
"log 0.4.8",
"parity-scale-codec",
"parking_lot 0.10.0",
@@ -5980,6 +5998,22 @@ dependencies = [
"tokio 0.1.22",
]
+[[package]]
+name = "sc-informant"
+version = "0.8.0"
+dependencies = [
+ "ansi_term 0.12.1",
+ "futures 0.3.4",
+ "log 0.4.8",
+ "parity-util-mem",
+ "sc-client-api",
+ "sc-network",
+ "sc-service",
+ "sp-blockchain",
+ "sp-runtime",
+ "wasm-timer",
+]
+
[[package]]
name = "sc-keystore"
version = "2.0.0"
@@ -6008,7 +6042,7 @@ dependencies = [
"fnv",
"fork-tree",
"futures 0.3.4",
- "futures-timer 0.4.0",
+ "futures-timer 3.0.1",
"futures_codec",
"libp2p",
"linked-hash-map",
@@ -6042,6 +6076,7 @@ dependencies = [
"tempfile",
"unsigned-varint",
"void",
+ "wasm-timer",
"zeroize 1.1.0",
]
@@ -6051,13 +6086,14 @@ version = "0.8.0"
dependencies = [
"futures 0.1.29",
"futures 0.3.4",
- "futures-timer 0.4.0",
+ "futures-timer 3.0.1",
"libp2p",
"log 0.4.8",
"lru 0.1.17",
"parking_lot 0.10.0",
"sc-network",
"sp-runtime",
+ "wasm-timer",
]
[[package]]
@@ -6067,7 +6103,7 @@ dependencies = [
"env_logger 0.7.1",
"futures 0.1.29",
"futures 0.3.4",
- "futures-timer 0.4.0",
+ "futures-timer 3.0.1",
"libp2p",
"log 0.4.8",
"parking_lot 0.10.0",
@@ -6096,7 +6132,7 @@ dependencies = [
"fnv",
"futures 0.1.29",
"futures 0.3.4",
- "futures-timer 2.0.2",
+ "futures-timer 3.0.1",
"hyper 0.12.35",
"hyper-rustls",
"log 0.4.8",
@@ -6128,6 +6164,7 @@ dependencies = [
"log 0.4.8",
"rand 0.7.3",
"serde_json",
+ "wasm-timer",
]
[[package]]
@@ -6224,7 +6261,7 @@ dependencies = [
"futures 0.1.29",
"futures 0.3.4",
"futures-diagnose",
- "futures-timer 2.0.2",
+ "futures-timer 3.0.1",
"grafana-data-source",
"lazy_static",
"log 0.4.8",
@@ -6266,6 +6303,7 @@ dependencies = [
"tokio 0.2.11",
"tokio-executor 0.1.10",
"tracing",
+ "wasm-timer",
]
[[package]]
@@ -6305,7 +6343,7 @@ version = "2.0.0"
dependencies = [
"bytes 0.5.4",
"futures 0.3.4",
- "futures-timer 2.0.2",
+ "futures-timer 3.0.1",
"libp2p",
"log 0.4.8",
"parking_lot 0.10.0",
@@ -6317,6 +6355,7 @@ dependencies = [
"slog-scope",
"take_mut",
"void",
+ "wasm-timer",
]
[[package]]
@@ -6352,6 +6391,7 @@ dependencies = [
"sp-runtime",
"sp-transaction-pool",
"substrate-test-runtime",
+ "wasm-timer",
]
[[package]]
@@ -6375,6 +6415,7 @@ dependencies = [
"sp-transaction-pool",
"substrate-test-runtime-client",
"substrate-test-runtime-transaction-pool",
+ "wasm-timer",
]
[[package]]
@@ -6504,6 +6545,12 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "686ef91cf020ad8d4aca9a7047641fd6add626b7b89e14546c2b6a76781cf822"
+[[package]]
+name = "send_wrapper"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f638d531eccd6e23b980caf34876660d38e265409d8e99b397ab71eb3612fad0"
+
[[package]]
name = "serde"
version = "1.0.104"
@@ -6853,7 +6900,7 @@ dependencies = [
"derive_more",
"futures 0.3.4",
"futures-diagnose",
- "futures-timer 0.4.0",
+ "futures-timer 3.0.1",
"libp2p",
"log 0.4.8",
"parity-scale-codec",
@@ -7234,6 +7281,7 @@ dependencies = [
"sp-inherents",
"sp-runtime",
"sp-std",
+ "wasm-timer",
]
[[package]]
diff --git a/Cargo.toml b/Cargo.toml
index 47e3fe3f0efce..0c620d251d097 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -35,6 +35,7 @@ members = [
"client/executor/wasmtime",
"client/executor/runtime-test",
"client/finality-grandpa",
+ "client/informant",
"client/tracing",
"client/keystore",
"client/network",
diff --git a/bin/node/cli/browser-demo/index.html b/bin/node/cli/browser-demo/index.html
index 0b66b612f10f7..f40863c46e77d 100644
--- a/bin/node/cli/browser-demo/index.html
+++ b/bin/node/cli/browser-demo/index.html
@@ -15,11 +15,12 @@
async function start() {
log('Loading WASM');
await init('./pkg/node_cli_bg.wasm');
- log('Successfully loaded WASM');
+ log('Fetching chain spec');
+ const chain_spec_response = await fetch("https://raw.githubusercontent.com/paritytech/substrate/master/bin/node/cli/res/flaming-fir.json");
+ const chain_spec_text = await chain_spec_response.text();
// Build our client.
- log('Starting client');
- let client = await start_client(ws());
+ let client = await start_client(chain_spec_text, 'info', ws());
log('Client started');
client.rpcSubscribe('{"method":"chain_subscribeNewHead","params":[],"id":1,"jsonrpc":"2.0"}',
diff --git a/bin/node/cli/src/browser.rs b/bin/node/cli/src/browser.rs
index e05238b82ddf1..80ca963445d0c 100644
--- a/bin/node/cli/src/browser.rs
+++ b/bin/node/cli/src/browser.rs
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Substrate. If not, see .
-use crate::ChainSpec;
+use crate::chain_spec::ChainSpec;
use log::info;
use wasm_bindgen::prelude::*;
use sc_service::Configuration;
@@ -22,20 +22,20 @@ use browser_utils::{
Transport, Client,
browser_configuration, set_console_error_panic_hook, init_console_log,
};
+use std::str::FromStr;
/// Starts the client.
#[wasm_bindgen]
-pub async fn start_client(wasm_ext: Transport) -> Result {
- start_inner(wasm_ext)
+pub async fn start_client(chain_spec: String, log_level: String, wasm_ext: Transport) -> Result {
+ start_inner(chain_spec, log_level, wasm_ext)
.await
.map_err(|err| JsValue::from_str(&err.to_string()))
}
-async fn start_inner(wasm_ext: Transport) -> Result> {
+async fn start_inner(chain_spec: String, log_level: String, wasm_ext: Transport) -> Result> {
set_console_error_panic_hook();
- init_console_log(log::Level::Info)?;
-
- let chain_spec = ChainSpec::FlamingFir.load()
+ init_console_log(log::Level::from_str(&log_level)?)?;
+ let chain_spec = ChainSpec::from_json_bytes(chain_spec.as_bytes().to_vec())
.map_err(|e| format!("{:?}", e))?;
let config: Configuration<_, _> = browser_configuration(wasm_ext, chain_spec)
diff --git a/client/authority-discovery/Cargo.toml b/client/authority-discovery/Cargo.toml
index 68144625b3f15..40b1b30173067 100644
--- a/client/authority-discovery/Cargo.toml
+++ b/client/authority-discovery/Cargo.toml
@@ -14,7 +14,7 @@ bytes = "0.4.12"
codec = { package = "parity-scale-codec", default-features = false, version = "1.0.3" }
derive_more = "0.99.2"
futures = "0.3.1"
-futures-timer = "2.0"
+futures-timer = "3.0.1"
libp2p = { version = "0.15.0", default-features = false, features = ["secp256k1", "libp2p-websocket"] }
log = "0.4.8"
prost = "0.6.1"
diff --git a/client/cli/Cargo.toml b/client/cli/Cargo.toml
index e302d53d55a61..e176894d64c07 100644
--- a/client/cli/Cargo.toml
+++ b/client/cli/Cargo.toml
@@ -21,6 +21,7 @@ tokio = { version = "0.2.9", features = [ "signal", "rt-core", "rt-threaded" ] }
futures = "0.3.1"
fdlimit = "0.1.1"
serde_json = "1.0.41"
+sc-informant = { version = "0.8", path = "../informant" }
sp-panic-handler = { version = "2.0.0", path = "../../primitives/panic-handler" }
sc-client-api = { version = "2.0.0", path = "../api" }
sp-blockchain = { version = "2.0.0", path = "../../primitives/blockchain" }
diff --git a/client/cli/src/lib.rs b/client/cli/src/lib.rs
index 54a98a6ad3951..e2e2e0302ecaf 100644
--- a/client/cli/src/lib.rs
+++ b/client/cli/src/lib.rs
@@ -24,7 +24,6 @@ mod traits;
mod params;
mod execution_strategy;
pub mod error;
-pub mod informant;
mod runtime;
mod node_key;
diff --git a/client/cli/src/runtime.rs b/client/cli/src/runtime.rs
index 62a2245c9e174..157b75f2050d1 100644
--- a/client/cli/src/runtime.rs
+++ b/client/cli/src/runtime.rs
@@ -21,7 +21,6 @@ use futures::select;
use futures::pin_mut;
use sc_service::{AbstractService, Configuration};
use crate::error;
-use crate::informant;
#[cfg(target_family = "unix")]
async fn main(func: F) -> Result<(), Box>
@@ -124,7 +123,7 @@ where
let service = service_builder(config)?;
- let informant_future = informant::build(&service);
+ let informant_future = sc_informant::build(&service, sc_informant::OutputFormat::Coloured);
let _informant_handle = runtime.spawn(informant_future);
// we eagerly drop the service so that the internal exit future is fired,
diff --git a/client/consensus/aura/Cargo.toml b/client/consensus/aura/Cargo.toml
index 142b10b9daf2d..e67f1e15a3e76 100644
--- a/client/consensus/aura/Cargo.toml
+++ b/client/consensus/aura/Cargo.toml
@@ -16,7 +16,7 @@ codec = { package = "parity-scale-codec", version = "1.0.0" }
sp-consensus = { version = "0.8", path = "../../../primitives/consensus/common" }
derive_more = "0.99.2"
futures = "0.3.1"
-futures-timer = "0.4.0"
+futures-timer = "3.0.1"
sp-inherents = { version = "2.0.0", path = "../../../primitives/inherents" }
sc-keystore = { version = "2.0.0", path = "../../keystore" }
log = "0.4.8"
diff --git a/client/consensus/babe/Cargo.toml b/client/consensus/babe/Cargo.toml
index 23bf9cea2841f..c36b5216c2d1f 100644
--- a/client/consensus/babe/Cargo.toml
+++ b/client/consensus/babe/Cargo.toml
@@ -32,7 +32,7 @@ sc-consensus-slots = { version = "0.8", path = "../slots" }
sp-runtime = { version = "2.0.0", path = "../../../primitives/runtime" }
fork-tree = { version = "2.0.0", path = "../../../utils/fork-tree" }
futures = "0.3.1"
-futures-timer = "0.4.0"
+futures-timer = "3.0.1"
parking_lot = "0.10.0"
log = "0.4.8"
schnorrkel = { version = "0.8.5", features = ["preaudit_deprecated"] }
diff --git a/client/consensus/slots/Cargo.toml b/client/consensus/slots/Cargo.toml
index d500a0fdc7732..67de0a54ed7b6 100644
--- a/client/consensus/slots/Cargo.toml
+++ b/client/consensus/slots/Cargo.toml
@@ -19,7 +19,7 @@ sc-telemetry = { version = "2.0.0", path = "../../telemetry" }
sp-consensus = { version = "0.8", path = "../../../primitives/consensus/common" }
sp-inherents = { version = "2.0.0", path = "../../../primitives/inherents" }
futures = "0.3.1"
-futures-timer = "2.0"
+futures-timer = "3.0.1"
parking_lot = "0.10.0"
log = "0.4.8"
diff --git a/client/finality-grandpa/Cargo.toml b/client/finality-grandpa/Cargo.toml
index 1249bff751d52..e96792258a279 100644
--- a/client/finality-grandpa/Cargo.toml
+++ b/client/finality-grandpa/Cargo.toml
@@ -8,7 +8,7 @@ license = "GPL-3.0"
[dependencies]
fork-tree = { version = "2.0.0", path = "../../utils/fork-tree" }
futures = "0.3.1"
-futures-timer = "2.0.2"
+futures-timer = "3.0.1"
log = "0.4.8"
parking_lot = "0.10.0"
rand = "0.7.2"
diff --git a/client/finality-grandpa/src/communication/periodic.rs b/client/finality-grandpa/src/communication/periodic.rs
index 463589969012f..f2e79e8f14486 100644
--- a/client/finality-grandpa/src/communication/periodic.rs
+++ b/client/finality-grandpa/src/communication/periodic.rs
@@ -19,7 +19,7 @@
use futures_timer::Delay;
use futures::{channel::mpsc, future::{FutureExt as _}, prelude::*, ready, stream::Stream};
use log::debug;
-use std::{pin::Pin, task::{Context, Poll}, time::{Instant, Duration}};
+use std::{pin::Pin, task::{Context, Poll}, time::Duration};
use sc_network::PeerId;
use sp_runtime::traits::{NumberFor, Block as BlockT};
@@ -28,10 +28,6 @@ use super::gossip::{NeighborPacket, GossipMessage};
// How often to rebroadcast, in cases where no new packets are created.
const REBROADCAST_AFTER: Duration = Duration::from_secs(2 * 60);
-fn rebroadcast_instant() -> Instant {
- Instant::now() + REBROADCAST_AFTER
-}
-
/// A sender used to send neighbor packets to a background job.
#[derive(Clone)]
pub(super) struct NeighborPacketSender(
@@ -85,7 +81,7 @@ impl Stream for NeighborPacketWorker {
match this.rx.poll_next_unpin(cx) {
Poll::Ready(None) => return Poll::Ready(None),
Poll::Ready(Some((to, packet))) => {
- this.delay.reset(rebroadcast_instant());
+ this.delay.reset(REBROADCAST_AFTER);
this.last = Some((to.clone(), packet.clone()));
return Poll::Ready(Some((to, GossipMessage::::from(packet.clone()))));
@@ -98,7 +94,7 @@ impl Stream for NeighborPacketWorker {
// Getting this far here implies that the timer fired.
- this.delay.reset(rebroadcast_instant());
+ this.delay.reset(REBROADCAST_AFTER);
// Make sure the underlying task is scheduled for wake-up.
//
diff --git a/client/informant/Cargo.toml b/client/informant/Cargo.toml
new file mode 100644
index 0000000000000..197f320889c0d
--- /dev/null
+++ b/client/informant/Cargo.toml
@@ -0,0 +1,19 @@
+[package]
+name = "sc-informant"
+version = "0.8.0"
+authors = ["Parity Technologies "]
+description = "Substrate informant."
+edition = "2018"
+license = "GPL-3.0"
+
+[dependencies]
+ansi_term = "0.12.1"
+futures = "0.3.1"
+log = "0.4.8"
+parity-util-mem = { version = "0.5.1", default-features = false, features = ["primitive-types"] }
+wasm-timer = "0.2"
+sc-client-api = { version = "2.0.0", path = "../api" }
+sc-network = { version = "0.8", path = "../network" }
+sc-service = { version = "0.8", default-features = false, path = "../service" }
+sp-blockchain = { version = "2.0.0", path = "../../primitives/blockchain" }
+sp-runtime = { version = "2.0.0", path = "../../primitives/runtime" }
diff --git a/client/cli/src/informant/display.rs b/client/informant/src/display.rs
similarity index 76%
rename from client/cli/src/informant/display.rs
rename to client/informant/src/display.rs
index 199635e7c7883..53c9697868348 100644
--- a/client/cli/src/informant/display.rs
+++ b/client/informant/src/display.rs
@@ -20,7 +20,9 @@ use log::info;
use sc_network::SyncState;
use sp_runtime::traits::{Block as BlockT, CheckedDiv, NumberFor, Zero, Saturating};
use sc_service::NetworkStatus;
-use std::{convert::{TryFrom, TryInto}, fmt, time};
+use std::{convert::{TryFrom, TryInto}, fmt};
+use wasm_timer::Instant;
+use crate::OutputFormat;
/// State of the informant display system.
///
@@ -40,15 +42,18 @@ pub struct InformantDisplay {
/// `None` if `display` has never been called.
last_number: Option>,
/// The last time `display` or `new` has been called.
- last_update: time::Instant,
+ last_update: Instant,
+ /// The format to print output in.
+ format: OutputFormat,
}
impl InformantDisplay {
/// Builds a new informant display system.
- pub fn new() -> InformantDisplay {
+ pub fn new(format: OutputFormat) -> InformantDisplay {
InformantDisplay {
last_number: None,
- last_update: time::Instant::now(),
+ last_update: Instant::now(),
+ format,
}
}
@@ -56,8 +61,10 @@ impl InformantDisplay {
pub fn display(&mut self, info: &ClientInfo, net_status: NetworkStatus) {
let best_number = info.chain.best_number;
let best_hash = info.chain.best_hash;
+ let finalized_number = info.chain.finalized_number;
+ let num_connected_peers = net_status.num_connected_peers;
let speed = speed::(best_number, self.last_number, self.last_update);
- self.last_update = time::Instant::now();
+ self.last_update = Instant::now();
self.last_number = Some(best_number);
let (status, target) = match (net_status.sync_state, net_status.best_seen_block) {
@@ -66,19 +73,35 @@ impl InformantDisplay {
(SyncState::Downloading, Some(n)) => (format!("Syncing{}", speed), format!(", target=#{}", n)),
};
- info!(
- target: "substrate",
- "{}{} ({} peers), best: #{} ({}), finalized #{} ({}), ⬇ {} ⬆ {}",
- Colour::White.bold().paint(&status),
- target,
- Colour::White.bold().paint(format!("{}", net_status.num_connected_peers)),
- Colour::White.paint(format!("{}", best_number)),
- best_hash,
- Colour::White.paint(format!("{}", info.chain.finalized_number)),
- info.chain.finalized_hash,
- TransferRateFormat(net_status.average_download_per_sec),
- TransferRateFormat(net_status.average_upload_per_sec),
- );
+ if self.format == OutputFormat::Coloured {
+ info!(
+ target: "substrate",
+ "{}{} ({} peers), best: #{} ({}), finalized #{} ({}), ⬇ {} ⬆ {}",
+ Colour::White.bold().paint(&status),
+ target,
+ Colour::White.bold().paint(format!("{}", num_connected_peers)),
+ Colour::White.paint(format!("{}", best_number)),
+ best_hash,
+ Colour::White.paint(format!("{}", finalized_number)),
+ info.chain.finalized_hash,
+ TransferRateFormat(net_status.average_download_per_sec),
+ TransferRateFormat(net_status.average_upload_per_sec),
+ );
+ } else {
+ info!(
+ target: "substrate",
+ "{}{} ({} peers), best: #{} ({}), finalized #{} ({}), ⬇ {} ⬆ {}",
+ status,
+ target,
+ num_connected_peers,
+ best_number,
+ best_hash,
+ finalized_number,
+ info.chain.finalized_hash,
+ TransferRateFormat(net_status.average_download_per_sec),
+ TransferRateFormat(net_status.average_upload_per_sec),
+ );
+ }
}
}
@@ -87,7 +110,7 @@ impl InformantDisplay {
fn speed(
best_number: NumberFor,
last_number: Option>,
- last_update: time::Instant
+ last_update: Instant
) -> String {
// Number of milliseconds elapsed since last time.
let elapsed_ms = {
diff --git a/client/cli/src/informant.rs b/client/informant/src/lib.rs
similarity index 90%
rename from client/cli/src/informant.rs
rename to client/informant/src/lib.rs
index 9e7c5044e046d..699dcfdd7425e 100644
--- a/client/cli/src/informant.rs
+++ b/client/informant/src/lib.rs
@@ -25,12 +25,19 @@ use std::time::Duration;
mod display;
+/// The format to print telemetry output in.
+#[derive(PartialEq)]
+pub enum OutputFormat {
+ Coloured,
+ Plain,
+}
+
/// Creates an informant in the form of a `Future` that must be polled regularly.
-pub fn build(service: &impl AbstractService) -> impl futures::Future