mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-10 07:04:22 +00:00
Merge #10953
10953: minor: Bump `tracing` r=lnicola a=lnicola bors r+ Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
This commit is contained in:
commit
9ae3158292
4 changed files with 29 additions and 16 deletions
12
Cargo.lock
generated
12
Cargo.lock
generated
|
@ -881,9 +881,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "matchers"
|
||||
version = "0.0.1"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f099785f7595cc4b4553a174ce30dd7589ef93391ff414dbb67f62392b9e0ce1"
|
||||
checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558"
|
||||
dependencies = [
|
||||
"regex-automata",
|
||||
]
|
||||
|
@ -1731,9 +1731,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "tracing-subscriber"
|
||||
version = "0.2.25"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0e0d2eaa99c3c2e41547cfa109e910a68ea03823cccad4a0525dcbc9b01e8c71"
|
||||
checksum = "245da694cc7fc4729f3f418b304cb57789f1bed2a78c575407ab8a23f53cb4d3"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"matchers",
|
||||
|
@ -1747,9 +1747,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "tracing-tree"
|
||||
version = "0.1.11"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a2a408a91fbd4850982080e643a261aef2a2ef72c8263ce353b61d25acfc2c49"
|
||||
checksum = "3ce989c9962c7f61fe084dd4a230eec784649dfc2392467c790007c3a6e134e7"
|
||||
dependencies = [
|
||||
"ansi_term",
|
||||
"atty",
|
||||
|
|
|
@ -36,8 +36,8 @@ limit = { path = "../limit", version = "0.0.0" }
|
|||
test_utils = { path = "../test_utils" }
|
||||
expect-test = "1.2.0-pre.1"
|
||||
tracing = "0.1"
|
||||
tracing-subscriber = { version = "0.2", default-features = false, features = [
|
||||
tracing-subscriber = { version = "0.3", default-features = false, features = [
|
||||
"env-filter",
|
||||
"registry",
|
||||
] }
|
||||
tracing-tree = { version = "0.1.10" }
|
||||
tracing-tree = "0.2"
|
||||
|
|
|
@ -34,14 +34,14 @@ rayon = "1.5"
|
|||
mimalloc = { version = "0.1.19", default-features = false, optional = true }
|
||||
lsp-server = "0.5.1"
|
||||
tracing = "0.1"
|
||||
tracing-subscriber = { version = "0.2", default-features = false, features = [
|
||||
tracing-subscriber = { version = "0.3", default-features = false, features = [
|
||||
"env-filter",
|
||||
"registry",
|
||||
"fmt",
|
||||
"tracing-log",
|
||||
] }
|
||||
tracing-log = "0.1.2"
|
||||
tracing-tree = { version = "0.1.10" }
|
||||
tracing-tree = "0.2"
|
||||
always-assert = "0.1"
|
||||
|
||||
stdx = { path = "../stdx", version = "0.0.0" }
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
//! filter syntax and `tracing_appender` for non blocking output.
|
||||
|
||||
use std::{
|
||||
fmt::{self, Write},
|
||||
fmt,
|
||||
fs::File,
|
||||
io,
|
||||
io::{self, Stderr},
|
||||
sync::Arc,
|
||||
};
|
||||
|
||||
|
@ -12,7 +12,10 @@ use rust_analyzer::Result;
|
|||
use tracing::{level_filters::LevelFilter, Event, Subscriber};
|
||||
use tracing_log::NormalizeEvent;
|
||||
use tracing_subscriber::{
|
||||
fmt::{writer::BoxMakeWriter, FmtContext, FormatEvent, FormatFields, FormattedFields},
|
||||
fmt::{
|
||||
format::Writer, writer::BoxMakeWriter, FmtContext, FormatEvent, FormatFields,
|
||||
FormattedFields, MakeWriter,
|
||||
},
|
||||
layer::SubscriberExt,
|
||||
registry::LookupSpan,
|
||||
util::SubscriberInitExt,
|
||||
|
@ -25,6 +28,16 @@ pub(crate) struct Logger {
|
|||
file: Option<File>,
|
||||
}
|
||||
|
||||
struct MakeWriterStderr;
|
||||
|
||||
impl<'a> MakeWriter<'a> for MakeWriterStderr {
|
||||
type Writer = Stderr;
|
||||
|
||||
fn make_writer(&'a self) -> Self::Writer {
|
||||
io::stderr()
|
||||
}
|
||||
}
|
||||
|
||||
impl Logger {
|
||||
pub(crate) fn new(file: Option<File>, filter: Option<&str>) -> Logger {
|
||||
let filter = filter.map_or(EnvFilter::default(), EnvFilter::new);
|
||||
|
@ -54,7 +67,7 @@ impl Logger {
|
|||
.with_indent_lines(true)
|
||||
.with_ansi(false)
|
||||
.with_indent_amount(2)
|
||||
.with_writer(std::io::stderr);
|
||||
.with_writer(io::stderr);
|
||||
|
||||
let writer = match self.file {
|
||||
Some(file) => BoxMakeWriter::new(Arc::new(file)),
|
||||
|
@ -96,7 +109,7 @@ where
|
|||
fn format_event(
|
||||
&self,
|
||||
ctx: &FmtContext<'_, S, N>,
|
||||
writer: &mut dyn Write,
|
||||
mut writer: Writer,
|
||||
event: &Event<'_>,
|
||||
) -> fmt::Result {
|
||||
// Write level and target
|
||||
|
@ -135,7 +148,7 @@ where
|
|||
})?;
|
||||
|
||||
// Write fields on the event
|
||||
ctx.field_format().format_fields(writer, event)?;
|
||||
ctx.field_format().format_fields(writer.by_ref(), event)?;
|
||||
|
||||
writeln!(writer)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue