Rework telemetry to replace the use of tracing with an object we pass around (#8143)

polkadot companion: paritytech/polkadot#2535
This commit is contained in:
Cecile Tonglet
2021-03-11 11:05:45 +01:00
committed by GitHub
parent 7aaba0c154
commit 8031b6eacb
55 changed files with 1028 additions and 838 deletions
+2 -10
View File
@@ -24,7 +24,6 @@ use sc_service::{
GenericChainSpec, RuntimeGenesis,
KeepBlocks, TransactionStorageMode,
};
use sc_telemetry::TelemetryHandle;
use sc_tracing::logging::LoggerBuilder;
use wasm_bindgen::prelude::*;
use futures::{
@@ -37,13 +36,8 @@ use libp2p_wasm_ext::{ExtTransport, ffi};
pub use console_error_panic_hook::set_once as set_console_error_panic_hook;
/// Initialize the logger and return a `TelemetryWorker` and a wasm `ExtTransport`.
pub fn init_logging_and_telemetry(
pattern: &str,
) -> Result<sc_telemetry::TelemetryWorker, sc_tracing::logging::Error> {
let transport = ExtTransport::new(ffi::websocket_transport());
let mut logger = LoggerBuilder::new(pattern);
logger.with_transport(transport);
logger.init()
pub fn init_logging(pattern: &str) -> Result<(), sc_tracing::logging::Error> {
LoggerBuilder::new(pattern).init()
}
/// Create a service configuration from a chain spec.
@@ -51,7 +45,6 @@ pub fn init_logging_and_telemetry(
/// This configuration contains good defaults for a browser light client.
pub async fn browser_configuration<G, E>(
chain_spec: GenericChainSpec<G, E>,
telemetry_handle: Option<TelemetryHandle>,
) -> Result<Configuration, Box<dyn std::error::Error>>
where
G: RuntimeGenesis + 'static,
@@ -82,7 +75,6 @@ where
async {}
}).into(),
telemetry_external_transport: Some(transport),
telemetry_handle,
role: Role::Light,
database: {
info!("Opening Indexed DB database '{}'...", name);