Skip to content
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

Events now unfiltered for fmt::writer::Boxed's MakeWriter impl #1694

Closed
estk opened this issue Oct 29, 2021 · 2 comments
Closed

Events now unfiltered for fmt::writer::Boxed's MakeWriter impl #1694

estk opened this issue Oct 29, 2021 · 2 comments
Assignees
Labels
crate/subscriber Related to the `tracing-subscriber` crate kind/bug Something isn't working

Comments

@estk
Copy link

estk commented Oct 29, 2021

Bug Report

I found that events are no longer sorted when contained in the fmt::writer::Boxed, here's the diff

Version

change from 0.2.25 to 0.3.1

Platform

x86_64-apple-darwin
rustc 1.57.0-nightly (9dbb26efe 2021-10-03)

Description

I have tests which verify the content of tracing output to either contain or not contain events based on the level. As of 0.3.1 events are completely unfiltered.

@hawkw hawkw added the kind/bug Something isn't working label Oct 29, 2021
@hawkw
Copy link
Member

hawkw commented Oct 29, 2021

Ah, I see what happened here. It looks like in commit 6cc6c47, which backported the change to add a lifetime parameter to MakeWriter (#781), I accidentally clobbered the make_writer_for method on BoxWriter, so that it only has make_writer: 6cc6c47#diff-c5dc275b15a60c1a2d4694da3797f4247c4f2e1e0978fd210dd14452d6746283L737-L739

this means that any filtering performed by the MakeWriter inside the box is now ignored. My bad!

Fortunately, fixing this is as simple as...putting the method back. Should have it taken care of momentarily!

@hawkw hawkw self-assigned this Oct 29, 2021
@hawkw hawkw added the crate/subscriber Related to the `tracing-subscriber` crate label Oct 29, 2021
hawkw added a commit that referenced this issue Oct 29, 2021
## Motivation

In `tracing-subscriber` 0.3.x, `MakeWriter` filtering seems to have
stopped working when using the `BoxMakeWriter` wrapper to erase the type
of a `MakeWriter` implementation. It looks like what happened is that
commit 6cc6c47, which backported the
change to add a lifetime parameter to `MakeWriter` (#781), I
accidentally clobbered the `make_writer_for` method on the inner `Boxed`
type, so that it only has `make_writer`:
6cc6c47#diff-c5dc275b15a60c1a2d4694da3797f4247c4f2e1e0978fd210dd14452d6746283L737-L739

This meant that any filtering performed by the `MakeWriter` inside the
box is now ignored. My bad!

## Solution

This commit puts back the missing `make_writer_for` method. Whoops!

Fixes #1694
hawkw added a commit that referenced this issue Oct 29, 2021
## Motivation

In `tracing-subscriber` 0.3.x, `MakeWriter` filtering seems to have
stopped working when using the `BoxMakeWriter` wrapper to erase the type
of a `MakeWriter` implementation. It looks like what happened is that
commit 6cc6c47, which backported the
change to add a lifetime parameter to `MakeWriter` (#781), I
accidentally clobbered the `make_writer_for` method on the inner `Boxed`
type, so that it only has `make_writer`:
6cc6c47#diff-c5dc275b15a60c1a2d4694da3797f4247c4f2e1e0978fd210dd14452d6746283L737-L739

This meant that any filtering performed by the `MakeWriter` inside the
box is now ignored. My bad!

## Solution

This commit puts back the missing `make_writer_for` method. Whoops!

Fixes #1694
@hawkw
Copy link
Member

hawkw commented Oct 29, 2021

Fixed by #1695!

@hawkw hawkw closed this as completed Oct 29, 2021
hawkw added a commit that referenced this issue Nov 20, 2021
# 0.3.2 (Nov 19, 2021)

### Fixed

- **fmt**: Fixed `MakeWriter` filtering not working with `BoxMakeWriter`
  ([#1694])

### Added

- **fmt**: `Writer::has_ansi_escapes` method to check if an output
  supports ANSI terminal formatting escape codes ([#1696])
- **fmt**: Added additional ANSI terminal formatting to field formatters
  when supported ([#1702])
- **fmt**: Added `FmtContext::span_scope`, `FmtContext::event_scope`,
  and `FmtContext::parent_span` methods for accessing the current span
  and its scope when formatting an event ([#1728])
- **fmt**: Improved documentation on implementing event formatters
  ([#1727])

[#1694]: #1694
[#1696]: #1696
[#1702]: #1702
[#1728]: #1728
[#1727]: #1727
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crate/subscriber Related to the `tracing-subscriber` crate kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants