-
Notifications
You must be signed in to change notification settings - Fork 734
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fmt: with_ansi(false)
doesn't affect function parameter from #[instrument] while pretty()
#1310
Comments
This has been fixed in 8985d97 |
Thanks for the info, but the issue is not or not entirely fixed by the mentioned commit. My issue was out of scope for this commit, but a workaround is mentioned which does work for me. In my interpretation of the commit message (below) I assume that #658 could fix this issue?
EDIT: Reworked comment completely |
Create a fmt layer, then set ansi is false works for me. use tracing_subscriber::fmt;
let log_format = fmt::format()
.with_target(false)
.with_ansi(false)
.with_source_location(true)
.compact();
let mut fmt_layer = fmt::layer().event_format(log_format);
fmt_layer.set_ansi(false);
tracing_subscriber::registry()
.with(fmt_layer).init(); |
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/ortracing-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 withpretty()
.Example
main.rs
:One can see that the
param1
is fat when run withpretty()
.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()
:Output with
compact()
:The text was updated successfully, but these errors were encountered: