From 8b8925e949a5c7a35a0b7d50cfad4b36ba5033cb Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Mon, 25 Jul 2022 17:42:42 +1000 Subject: [PATCH 1/6] Add new feature fancy-no-backtrace (enabled by default) Signed-off-by: Jiahao XU --- Cargo.toml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 585dcc63..19946ec9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,7 +32,7 @@ futures-util = { version = "0.3.21", default-features = false } home = "0.5.3" jobserver = "0.1.24" log = "0.4.17" -miette = { version = "5.1.1", features = ["fancy-no-backtrace"] } +miette = "5.1.1" mimalloc = { version = "0.1.29", default-features = false, optional = true } once_cell = "1.13.0" reqwest = { version = "0.11.11", features = ["stream"], default-features = false } @@ -68,7 +68,7 @@ zstd = { version = "0.10.0", default-features = false } guess_host_triple = "0.1.3" [features] -default = ["static", "zlib-ng", "rustls"] +default = ["static", "zlib-ng", "rustls", "fancy-no-backtrace"] mimalloc = ["dep:mimalloc"] @@ -80,6 +80,8 @@ zlib-ng = ["flate2/zlib-ng"] rustls = ["crates_io_api/rustls", "reqwest/rustls-tls"] native-tls = ["reqwest/native-tls"] +fancy-no-backtrace = ["miette/fancy-no-backtrace"] + [dev-dependencies] env_logger = "0.9.0" From df77ad9bba0bf2a062f625f30e5a3f6249944ca3 Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Mon, 25 Jul 2022 17:44:10 +1000 Subject: [PATCH 2/6] Add new feature fancy-with-backtrace Signed-off-by: Jiahao XU --- Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/Cargo.toml b/Cargo.toml index 19946ec9..1411f0c5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -81,6 +81,7 @@ rustls = ["crates_io_api/rustls", "reqwest/rustls-tls"] native-tls = ["reqwest/native-tls"] fancy-no-backtrace = ["miette/fancy-no-backtrace"] +fancy-with-backtrace = ["fancy-no-backtrace", "miette/fancy"] [dev-dependencies] env_logger = "0.9.0" From aca4528273dc5070fee420d2bdcf94a072580481 Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Mon, 25 Jul 2022 17:45:19 +1000 Subject: [PATCH 3/6] Enable fancy-with-backtrace on debug build Signed-off-by: Jiahao XU --- ci-scripts/compile-settings.jq | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci-scripts/compile-settings.jq b/ci-scripts/compile-settings.jq index 7c739643..d5231c09 100644 --- a/ci-scripts/compile-settings.jq +++ b/ci-scripts/compile-settings.jq @@ -5,7 +5,7 @@ if $for_release then { } else { output: "debug", profile: "dev", - args: ($matrix.debug_build_args // "--no-default-features --features rustls"), + args: ($matrix.debug_build_args // "--no-default-features --features rustls,fancy-with-backtrace"), } end | { From daae462e590a9edeaa74a84a61b155176663b0d3 Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Mon, 25 Jul 2022 17:45:34 +1000 Subject: [PATCH 4/6] Update `Cargo.lock` Signed-off-by: Jiahao XU --- Cargo.lock | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index ff2c415d..565442da 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,15 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "addr2line" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" +dependencies = [ + "gimli", +] + [[package]] name = "adler" version = "1.0.2" @@ -45,6 +54,21 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[package]] +name = "backtrace" +version = "0.3.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cab84319d616cfb654d03394f38ab7e6f0919e181b1b57e1fd15e7fb4077d9a7" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + [[package]] name = "base64" version = "0.13.0" @@ -541,6 +565,12 @@ dependencies = [ "wasi", ] +[[package]] +name = "gimli" +version = "0.26.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" + [[package]] name = "guess_host_triple" version = "0.1.3" @@ -849,6 +879,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "89d67f6972a70e33dbb5551875c6a3e46ae0a7cddd4661a2811ee48be51054e9" dependencies = [ "atty", + "backtrace", "miette-derive", "once_cell", "owo-colors", @@ -964,6 +995,15 @@ dependencies = [ "libc", ] +[[package]] +name = "object" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" version = "1.13.0" @@ -1197,6 +1237,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "rustc-demangle" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" + [[package]] name = "rustc_version" version = "0.4.0" From 77396d45bd748d3ea2279378c1e6fe3b778b2130 Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Mon, 25 Jul 2022 17:46:59 +1000 Subject: [PATCH 5/6] Fix release build for win: Enable fancy-no-backtrace Signed-off-by: Jiahao XU --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1d84bc12..b81714f9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -36,7 +36,7 @@ jobs: - target: x86_64-pc-windows-msvc os: windows-latest debug_build_args: --no-default-features --features native-tls - release_build_args: --no-default-features --features static,zlib-ng,native-tls + release_build_args: --no-default-features --features static,zlib-ng,native-tls,fancy-no-backtrace - target: x86_64-unknown-linux-musl os: ubuntu-latest - target: armv7-unknown-linux-musleabihf From c52a7b2c3b004476bab378e48b524a70442c2acd Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Mon, 25 Jul 2022 17:57:54 +1000 Subject: [PATCH 6/6] Add new feature log_release_max_level_info Signed-off-by: Jiahao XU --- Cargo.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 1411f0c5..7b8df205 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -83,6 +83,8 @@ native-tls = ["reqwest/native-tls"] fancy-no-backtrace = ["miette/fancy-no-backtrace"] fancy-with-backtrace = ["fancy-no-backtrace", "miette/fancy"] +log_release_max_level_info = ["log/release_max_level_info"] + [dev-dependencies] env_logger = "0.9.0"