-
Notifications
You must be signed in to change notification settings - Fork 817
Description
Bug Report
Version
$ cargo tree | grep tracing
├── tracing v0.1.25
│ ├── tracing-attributes v0.1.15 (proc-macro)
│ └── tracing-core v0.1.17
└── tracing-subscriber v0.2.17
├── tracing v0.1.25 ()
├── tracing-core v0.1.17 ()
├── tracing-log v0.1.2
│ └── tracing-core v0.1.17 ()
└── tracing-serde v0.1.2
└── tracing-core v0.1.17 ()
Platform
Linux mayumi 5.4.0-67-generic #75-Ubuntu SMP Fri Feb 19 18:03:38 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Crates
I assume tracing-subscriber
and/or tracing-attributes
.
Description
I wanted to implement tracing-appender
to write to a file so I deactivated ANSI, but still got ANSI sequences in my log files. I tracked it down to parameters from functions with the #[instrument]
attribute in combination with pretty()
.
Example main.rs
:
extern crate tracing;
extern crate tracing_subscriber;
use tracing::*;
fn main() {
tracing_subscriber::fmt()
.pretty()
// .compact()
.with_ansi(false)
.with_thread_names(true)
.init();
error!("Starting");
func(1);
error!("Finishing");
}
#[instrument]
fn func (param1: i32) -> i32 {
error!("Inside func");
param1
}
One can see that the param1
is fat when run with pretty()
.
I let the output write to a file for easier showing using the example here: https://docs.rs/tracing-appender/0.1.2/tracing_appender/#non-blocking-rolling-file-appender
Output with pretty()
:
Mar 17 22:45:09.288 ERRORrulaub_backend: Starting
at rust_backend/src/main.rs:12 on main
Mar 17 22:45:09.288 ERRORrulaub_backend: Inside func
at rust_backend/src/main.rs:19 on main
in rulaub_backend::func with �[1mparam1�[0m: 1
Mar 17 22:45:09.288 ERRORrulaub_backend: Finishing
at rust_backend/src/main.rs:14 on main
Output with compact()
:
Mar 17 22:45:16.708 ERROR main rulaub_backend:Starting
Mar 17 22:45:16.708 ERROR main func: rulaub_backend:Inside func{param1}
Mar 17 22:45:16.709 ERROR main rulaub_backend:Finishing