diff --git a/Cargo.toml b/Cargo.toml index 98cd1a1e3..f19213b44 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,7 +40,7 @@ querystring = { version = "1.1.0", default-features = false } regex = { version = "1.10.4", features = ["std"], default-features = false } serde_json = { version = "1.0", default-features = false} serde = { version = "1.0", features = ["derive"], default-features = false } -tokio = { version = "1.44.1", default-features = false } +tokio = { version = "1.44.1", default-features = false} tokio-tungstenite = { version = "0.20.1", default-features = false } url = { version = "=2.5.0", default-features = false} urlencoding = { version = "2.1.0", default-features = false} diff --git a/core/main/Cargo.toml b/core/main/Cargo.toml index bd0297a8f..054f5a635 100644 --- a/core/main/Cargo.toml +++ b/core/main/Cargo.toml @@ -44,6 +44,7 @@ contract_tests = [ "websocket_contract_tests", ] tdk=[] +console = ["console-subscriber"] [dependencies] base64.workspace = true ripple_sdk = { workspace = true, features = ["full"] } @@ -69,6 +70,7 @@ jaq-core = "1.5.0" jaq-std = { version = "1.5.1", default-features = false } strum = { version = "0.24", default-features = false } strum_macros = "0.24" +console-subscriber = { version = "0.1", optional = true } # openrpc_validator is optional and not part of the default workspace # Only included when openrpc_validation feature is enabled diff --git a/core/main/src/firebolt/handlers/provider_registrar.rs b/core/main/src/firebolt/handlers/provider_registrar.rs index f5b88ebd2..5d9d51b94 100644 --- a/core/main/src/firebolt/handlers/provider_registrar.rs +++ b/core/main/src/firebolt/handlers/provider_registrar.rs @@ -160,8 +160,8 @@ impl ProviderRegistrar { rpc_module: &mut RpcModule, ) -> bool { info!( - "register_method: method_name={}, method_type={:?}, rpc_module={:?}", - method_name, method_type, rpc_module + "register_method: method_name={}, method_type={:?}", + method_name, method_type ); let result = match method_type { diff --git a/core/main/src/main.rs b/core/main/src/main.rs index 3bb09e175..8f48189bf 100644 --- a/core/main/src/main.rs +++ b/core/main/src/main.rs @@ -31,8 +31,19 @@ pub mod state; pub mod utils; include!(concat!(env!("OUT_DIR"), "/version.rs")); +#[cfg(feature = "console")] +fn init_console() { + console_subscriber::ConsoleLayer::builder() + .server_addr(([127, 0, 0, 1], 6669)) + .init(); + println!("Tokio Console enabled - connect with 'tokio-console' command"); +} + #[tokio::main(worker_threads = 2)] async fn main() { + #[cfg(feature = "console")] + init_console(); + // Init logger if let Err(e) = init_and_configure_logger(SEMVER_LIGHTWEIGHT, "gateway".into(), None) { println!("{:?} logger init error", e); diff --git a/device/mock_device/Cargo.toml b/device/mock_device/Cargo.toml index 4519a68c8..1886f7841 100644 --- a/device/mock_device/Cargo.toml +++ b/device/mock_device/Cargo.toml @@ -22,6 +22,9 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[features] +console = ["console-subscriber", "tokio/tracing"] + [lib] crate-type = ["cdylib"] @@ -37,7 +40,7 @@ serde_json.workspace = true serde.workspace = true url.workspace = true tokio = { workspace = true, features = ["macros", "sync", "rt"] } - +console-subscriber = { version = "0.1", optional = true } [dev-dependencies] ripple_tdk = { path = "../../core/tdk" }