Log panics with full backtrace as errors (#1404)

* Log panics with full backtrace as errors

* Store backtraces
This commit is contained in:
Dániel Buga 2022-09-30 20:58:28 +02:00 committed by GitHub
parent bd7701ed82
commit 7de4193e47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 0 deletions

11
Cargo.lock generated
View File

@ -2697,6 +2697,7 @@ dependencies = [
"lapce-data",
"lapce-rpc",
"log 0.4.17",
"log-panics",
"lsp-types",
"once_cell",
"open",
@ -2856,6 +2857,16 @@ dependencies = [
"cfg-if 1.0.0",
]
[[package]]
name = "log-panics"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68f9dd8546191c1850ecf67d22f5ff00a935b890d0e84713159a55495cc2ac5f"
dependencies = [
"backtrace",
"log 0.4.17",
]
[[package]]
name = "lsp-types"
version = "0.93.1"

View File

@ -15,6 +15,7 @@ rayon = "1.5.1"
alacritty_terminal = "0.16"
config = "0.11"
itertools = "0.10.1"
log-panics = { version = "2.1.0", features = ["with-backtrace"] }
unicode-width = "0.1.8"
im = { version = "15.0.0", features = ["serde"] }
regex = "1.5.6"

View File

@ -89,6 +89,10 @@ pub fn launch() {
Err(e) => eprintln!("Initialising logging failed {e:?}"),
}
log_panics::Config::new()
.backtrace_mode(log_panics::BacktraceMode::Resolved)
.install_panic_hook();
let mut launcher = AppLauncher::new().delegate(LapceAppDelegate::new());
let mut data = LapceData::load(launcher.get_external_handle(), paths);
for (_window_id, window_data) in data.windows.iter_mut() {