1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-25 08:39:09 -05:00

chore: enable log feature for tracing crate (#25078)

This commit enables the `log` feature for the `tracing` crate.

This allows us to examine additional detailed logs emitted by third party crates
that use `tracing` crate for logging by setting `RUST_LOG` env var or passing
`-L` option in command line.

Closes #25045
This commit is contained in:
Yusuke Tanaka 2024-08-23 11:15:10 +09:00 committed by Luca Casonato
parent bf1328bd29
commit 5b0d5b2e6b
No known key found for this signature in database
GPG key ID: 01A83EB62563811F
4 changed files with 15 additions and 0 deletions

2
Cargo.lock generated
View file

@ -1245,6 +1245,7 @@ dependencies = [
"tokio", "tokio",
"tokio-util", "tokio-util",
"tower-lsp", "tower-lsp",
"tracing",
"twox-hash", "twox-hash",
"typed-arena", "typed-arena",
"uuid", "uuid",
@ -7580,6 +7581,7 @@ version = "0.1.40"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef"
dependencies = [ dependencies = [
"log",
"pin-project-lite", "pin-project-lite",
"tracing-attributes", "tracing-attributes",
"tracing-core", "tracing-core",

View file

@ -156,6 +156,7 @@ thiserror.workspace = true
tokio.workspace = true tokio.workspace = true
tokio-util.workspace = true tokio-util.workspace = true
tower-lsp.workspace = true tower-lsp.workspace = true
tracing = { version = "0.1", features = ["log", "default"] }
twox-hash.workspace = true twox-hash.workspace = true
typed-arena = "=2.0.2" typed-arena = "=2.0.2"
uuid = { workspace = true, features = ["serde"] } uuid = { workspace = true, features = ["serde"] }

View file

@ -46,6 +46,15 @@ pub fn init(maybe_level: Option<log::Level>) {
// in the cli logger // in the cli logger
.filter_module("deno::lsp::performance", log::LevelFilter::Debug) .filter_module("deno::lsp::performance", log::LevelFilter::Debug)
.filter_module("rustls", log::LevelFilter::Off) .filter_module("rustls", log::LevelFilter::Off)
// swc_ecma_codegen's `srcmap!` macro emits error-level spans only on debug
// build:
// https://github.com/swc-project/swc/blob/74d6478be1eb8cdf1df096c360c159db64b64d8a/crates/swc_ecma_codegen/src/macros.rs#L112
// We suppress them here to avoid flooding our CI logs in integration tests.
.filter_module("swc_ecma_codegen", log::LevelFilter::Off)
.filter_module("swc_ecma_transforms_optimization", log::LevelFilter::Off)
.filter_module("swc_ecma_parser", log::LevelFilter::Error)
// Suppress span lifecycle logs since they are too verbose
.filter_module("tracing::span", log::LevelFilter::Off)
.format(|buf, record| { .format(|buf, record| {
let mut target = record.target().to_string(); let mut target = record.target().to_string();
if let Some(line_no) = record.line() { if let Some(line_no) = record.line() {

View file

@ -2,5 +2,8 @@
[# that serves the same packages. The important bit is the message below.] [# that serves the same packages. The important bit is the message below.]
[WILDCARD] No .npmrc file found [WILDCARD] No .npmrc file found
[WILDCARD] [WILDCARD]
Download http://localhost:4260/@denotest/esm-basic
[WILDCARD]
Download http://localhost:4260/@denotest/esm-basic/1.0.0.tgz Download http://localhost:4260/@denotest/esm-basic/1.0.0.tgz
[WILDCARD]
Initialize @denotest/esm-basic@1.0.0 Initialize @denotest/esm-basic@1.0.0