diff options
author | Dmitry Sharshakov | 2021-08-12 13:45:01 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-08-20 04:43:54 +0000 |
commit | fd709bc56dae91fdd183486360dd08ac535c5c5b (patch) | |
tree | e4da27e7c3be65c3669fd6ef246a8c15a0537060 /helix-dap/examples/dap-basic.rs | |
parent | 0f6e81b85be6e7e8f08446f3cd373da38dd67360 (diff) |
dap: logging using fern
Diffstat (limited to 'helix-dap/examples/dap-basic.rs')
-rw-r--r-- | helix-dap/examples/dap-basic.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/helix-dap/examples/dap-basic.rs b/helix-dap/examples/dap-basic.rs index 45522516..7056f77a 100644 --- a/helix-dap/examples/dap-basic.rs +++ b/helix-dap/examples/dap-basic.rs @@ -2,6 +2,17 @@ use helix_dap::{Client, Result, SourceBreakpoint}; #[tokio::main] pub async fn main() -> Result<()> { + let base_config = fern::Dispatch::new().level(log::LevelFilter::Info); + + let stderr_config = fern::Dispatch::new() + .format(|out, message, record| out.finish(format_args!("[{}] {}", record.level(), message))) + .chain(std::io::stderr()); + + base_config + .chain(stderr_config) + .apply() + .expect("Failed to set up logging"); + let mut client = Client::start("nc", vec!["127.0.0.1", "7777"], 0)?; println!("init: {:?}", client.initialize().await); |