aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2020-10-23 16:07:06 +0100
committerFlorian Diebold <[email protected]>2020-10-25 12:53:38 +0000
commit39dfca23f1634c1e21819806bdd696c8096d0f0f (patch)
tree06fc97459be2a8a210d03a43542c9297a9d8d4f6 /crates
parent34034e4a64cd49e82171601e55ab6dd1d5b52cd4 (diff)
Add tracing to main rust-analyzer binary
Diffstat (limited to 'crates')
-rw-r--r--crates/hir_ty/Cargo.toml2
-rw-r--r--crates/rust-analyzer/Cargo.toml3
-rw-r--r--crates/rust-analyzer/src/bin/main.rs22
3 files changed, 26 insertions, 1 deletions
diff --git a/crates/hir_ty/Cargo.toml b/crates/hir_ty/Cargo.toml
index be7c812cb..367a1b98d 100644
--- a/crates/hir_ty/Cargo.toml
+++ b/crates/hir_ty/Cargo.toml
@@ -17,7 +17,7 @@ ena = "0.14.0"
17log = "0.4.8" 17log = "0.4.8"
18rustc-hash = "1.1.0" 18rustc-hash = "1.1.0"
19scoped-tls = "1" 19scoped-tls = "1"
20chalk-solve = "0.34" 20chalk-solve = { version = "0.34", default-features = false }
21chalk-ir = "0.34" 21chalk-ir = "0.34"
22chalk-recursive = "0.34" 22chalk-recursive = "0.34"
23 23
diff --git a/crates/rust-analyzer/Cargo.toml b/crates/rust-analyzer/Cargo.toml
index 2f0fa9726..975b24aaf 100644
--- a/crates/rust-analyzer/Cargo.toml
+++ b/crates/rust-analyzer/Cargo.toml
@@ -32,6 +32,9 @@ threadpool = "1.7.1"
32rayon = "1.5" 32rayon = "1.5"
33mimalloc = { version = "0.1.19", default-features = false, optional = true } 33mimalloc = { version = "0.1.19", default-features = false, optional = true }
34lsp-server = "0.4.0" 34lsp-server = "0.4.0"
35tracing = "0.1"
36tracing-subscriber = { version = "0.2", default-features = false, features = ["env-filter", "registry"] }
37tracing-tree = { version = "0.1.4" }
35 38
36stdx = { path = "../stdx", version = "0.0.0" } 39stdx = { path = "../stdx", version = "0.0.0" }
37flycheck = { path = "../flycheck", version = "0.0.0" } 40flycheck = { path = "../flycheck", version = "0.0.0" }
diff --git a/crates/rust-analyzer/src/bin/main.rs b/crates/rust-analyzer/src/bin/main.rs
index 97b246a32..4175e569e 100644
--- a/crates/rust-analyzer/src/bin/main.rs
+++ b/crates/rust-analyzer/src/bin/main.rs
@@ -68,10 +68,32 @@ fn setup_logging(log_file: Option<PathBuf>) -> Result<()> {
68 let filter = env::var("RA_LOG").ok(); 68 let filter = env::var("RA_LOG").ok();
69 logger::Logger::new(log_file, filter.as_deref()).install(); 69 logger::Logger::new(log_file, filter.as_deref()).install();
70 70
71 tracing_setup::setup_tracing()?;
72
71 profile::init(); 73 profile::init();
72 Ok(()) 74 Ok(())
73} 75}
74 76
77mod tracing_setup {
78 use tracing::subscriber;
79 use tracing_subscriber::layer::SubscriberExt;
80 use tracing_subscriber::EnvFilter;
81 use tracing_subscriber::Registry;
82 use tracing_tree::HierarchicalLayer;
83
84 pub fn setup_tracing() -> super::Result<()> {
85 let filter = EnvFilter::from_env("CHALK_DEBUG");
86 let layer = HierarchicalLayer::default()
87 .with_indent_lines(true)
88 .with_ansi(false)
89 .with_indent_amount(2)
90 .with_writer(std::io::stderr);
91 let subscriber = Registry::default().with(filter).with(layer);
92 subscriber::set_global_default(subscriber)?;
93 Ok(())
94 }
95}
96
75fn run_server() -> Result<()> { 97fn run_server() -> Result<()> {
76 log::info!("server will start"); 98 log::info!("server will start");
77 99