Fix the browser node and ensure it doesn't colour the informant output (#6457)

* Fix browser informant

* Fix documentation

* Add an informant_output_format function to the cli config

* Wrap informant output format in an option

* Revert batch verifier

* Remove wasm-timer from primitives io cargo lock

* Drop informant_output_format function

* derive debug for output format
This commit is contained in:
Ashley
2020-06-23 16:50:33 +02:00
committed by GitHub
parent 6647a42a67
commit d976f712b1
10 changed files with 40 additions and 50 deletions
+1 -45
View File
@@ -102,7 +102,6 @@ pub struct ServiceBuilder<TBl, TRtApi, TCl, TFchr, TSc, TImpQu, TFprb, TFpp,
remote_backend: Option<Arc<dyn RemoteBlockchain<TBl>>>,
marker: PhantomData<(TBl, TRtApi)>,
block_announce_validator_builder: Option<Box<dyn FnOnce(Arc<TCl>) -> Box<dyn BlockAnnounceValidator<TBl> + Send> + Send>>,
informant_prefix: String,
}
/// A utility trait for building an RPC extension given a `DenyUnsafe` instance.
@@ -366,7 +365,6 @@ impl ServiceBuilder<(), (), (), (), (), (), (), (), (), (), ()> {
rpc_extensions_builder: Box::new(|_| ()),
remote_backend: None,
block_announce_validator_builder: None,
informant_prefix: Default::default(),
marker: PhantomData,
})
}
@@ -450,7 +448,6 @@ impl ServiceBuilder<(), (), (), (), (), (), (), (), (), (), ()> {
rpc_extensions_builder: Box::new(|_| ()),
remote_backend: Some(remote_blockchain),
block_announce_validator_builder: None,
informant_prefix: Default::default(),
marker: PhantomData,
})
}
@@ -545,7 +542,6 @@ impl<TBl, TRtApi, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, TExPool, TRpc, Backend>
rpc_extensions_builder: self.rpc_extensions_builder,
remote_backend: self.remote_backend,
block_announce_validator_builder: self.block_announce_validator_builder,
informant_prefix: self.informant_prefix,
marker: self.marker,
})
}
@@ -591,7 +587,6 @@ impl<TBl, TRtApi, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, TExPool, TRpc, Backend>
rpc_extensions_builder: self.rpc_extensions_builder,
remote_backend: self.remote_backend,
block_announce_validator_builder: self.block_announce_validator_builder,
informant_prefix: self.informant_prefix,
marker: self.marker,
})
}
@@ -630,7 +625,6 @@ impl<TBl, TRtApi, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, TExPool, TRpc, Backend>
rpc_extensions_builder: self.rpc_extensions_builder,
remote_backend: self.remote_backend,
block_announce_validator_builder: self.block_announce_validator_builder,
informant_prefix: self.informant_prefix,
marker: self.marker,
})
}
@@ -697,7 +691,6 @@ impl<TBl, TRtApi, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, TExPool, TRpc, Backend>
rpc_extensions_builder: self.rpc_extensions_builder,
remote_backend: self.remote_backend,
block_announce_validator_builder: self.block_announce_validator_builder,
informant_prefix: self.informant_prefix,
marker: self.marker,
})
}
@@ -754,7 +747,6 @@ impl<TBl, TRtApi, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, TExPool, TRpc, Backend>
rpc_extensions_builder: self.rpc_extensions_builder,
remote_backend: self.remote_backend,
block_announce_validator_builder: self.block_announce_validator_builder,
informant_prefix: self.informant_prefix,
marker: self.marker,
})
}
@@ -792,7 +784,6 @@ impl<TBl, TRtApi, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, TExPool, TRpc, Backend>
rpc_extensions_builder: Box::new(rpc_extensions_builder),
remote_backend: self.remote_backend,
block_announce_validator_builder: self.block_announce_validator_builder,
informant_prefix: self.informant_prefix,
marker: self.marker,
})
}
@@ -838,43 +829,9 @@ impl<TBl, TRtApi, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, TExPool, TRpc, Backend>
rpc_extensions_builder: self.rpc_extensions_builder,
remote_backend: self.remote_backend,
block_announce_validator_builder: Some(Box::new(block_announce_validator_builder)),
informant_prefix: self.informant_prefix,
marker: self.marker,
})
}
/// Defines the informant's prefix for the logs. An empty string by default.
///
/// By default substrate will show logs without a prefix. Example:
///
/// ```text
/// 2020-05-28 15:11:06 ✨ Imported #2 (0xc21c…2ca8)
/// 2020-05-28 15:11:07 💤 Idle (0 peers), best: #2 (0xc21c…2ca8), finalized #0 (0x7299…e6df), ⬇ 0 ⬆ 0
/// ```
///
/// But you can define a prefix by using this function. Example:
///
/// ```rust,ignore
/// service.with_informant_prefix("[Prefix] ".to_string());
/// ```
///
/// This will output:
///
/// ```text
/// 2020-05-28 15:11:06 ✨ [Prefix] Imported #2 (0xc21c…2ca8)
/// 2020-05-28 15:11:07 💤 [Prefix] Idle (0 peers), best: #2 (0xc21c…2ca8), finalized #0 (0x7299…e6df), ⬇ 0 ⬆ 0
/// ```
pub fn with_informant_prefix(
self,
informant_prefix: String,
) -> Result<ServiceBuilder<TBl, TRtApi, TCl, TFchr, TSc, TImpQu, TFprb, TFpp,
TExPool, TRpc, Backend>, Error>
where TSc: Clone, TFchr: Clone {
Ok(ServiceBuilder {
informant_prefix: informant_prefix,
..self
})
}
}
/// Implemented on `ServiceBuilder`. Allows running block commands, such as import/export/validate
@@ -990,7 +947,6 @@ ServiceBuilder<
rpc_extensions_builder,
remote_backend,
block_announce_validator_builder,
informant_prefix,
} = self;
sp_session::generate_initial_session_keys(
@@ -1142,7 +1098,7 @@ ServiceBuilder<
client.clone(),
network_status_sinks.clone(),
transaction_pool.clone(),
sc_informant::OutputFormat { enable_color: true, prefix: informant_prefix },
config.informant_output_format,
));
Ok(Service {
+2
View File
@@ -109,6 +109,8 @@ pub struct Configuration {
pub announce_block: bool,
/// Base path of the configuration
pub base_path: Option<BasePath>,
/// Configuration of the output format that the informant uses.
pub informant_output_format: sc_informant::OutputFormat,
}
/// Type for tasks spawned by the executor.