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

Use display_timestamp and display_level in Json format_event #1463

Merged
merged 1 commit into from
Jul 12, 2021
Merged

Use display_timestamp and display_level in Json format_event #1463

merged 1 commit into from
Jul 12, 2021

Conversation

lerouxrgd
Copy link
Contributor

Motivation

It should be possible to remove timestamp and level fields when using json formatting.

As of now this has no effect:

let subscriber = tracing_subscriber::fmt()
    .with_level(false)
    .without_time()
    .json()
    .finish();

Solution

Use the existing display_timestamp and display_level fields to conditionally serialize timestamp and level.

@lerouxrgd lerouxrgd requested review from davidbarsky, hawkw and a team as code owners July 9, 2021 14:38
Copy link
Member

@hawkw hawkw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me! thank you!

@hawkw hawkw merged commit c848820 into tokio-rs:master Jul 12, 2021
@lerouxrgd lerouxrgd deleted the fix/json-format branch July 13, 2021 15:01
hawkw pushed a commit that referenced this pull request Aug 17, 2021
…mat_event` (#1463)

## Motivation

It should be possible to remove `timestamp` and `level` fields when
using json formatting.

As of now this has no effect:

```rs
let subscriber = tracing_subscriber::fmt()
    .with_level(false)
    .without_time()
    .json()
    .finish();
```

## Solution

Use the existing `display_timestamp` and `display_level` fields to
conditionally serialize `timestamp` and `level`.
hawkw pushed a commit that referenced this pull request Aug 17, 2021
…mat_event` (#1463)

## Motivation

It should be possible to remove `timestamp` and `level` fields when
using json formatting.

As of now this has no effect:

```rs
let subscriber = tracing_subscriber::fmt()
    .with_level(false)
    .without_time()
    .json()
    .finish();
```

## Solution

Use the existing `display_timestamp` and `display_level` fields to
conditionally serialize `timestamp` and `level`.
hawkw added a commit that referenced this pull request Aug 17, 2021
# 0.2.20 (August 17, 2021)
### Fixed

- **fmt**: Fixed `fmt` printing only the first `source` for errors with
  a chain of sources ([#1460])
- **fmt**: Fixed missing space between level and event in the `Pretty`
  formatter ([#1498])
- **json**: Fixed `Json` formatter not honoring `without_time` and
  `with_level` configurations ([#1463])

### Added

- **registry**: Improved panic message when cloning a span whose ID
  doesn't exist, to aid in debugging issues with multiple subscribers
  ([#1483])
- **registry**: Improved documentation on span ID generation ([#1453])

Thanks to new contributors @joshtriplett and @lerouxgd, and returning
contributor @teozkr, for contributing to this release!

[#1460]: #1460
[#1483]: #1483
[#1463]: #1463
[#1453]: #1453
hawkw added a commit that referenced this pull request Aug 17, 2021
# 0.2.20 (August 17, 2021)
### Fixed

- **fmt**: Fixed `fmt` printing only the first `source` for errors with
  a chain of sources ([#1460])
- **fmt**: Fixed missing space between level and event in the `Pretty`
  formatter ([#1498])
- **json**: Fixed `Json` formatter not honoring `without_time` and
  `with_level` configurations ([#1463])

### Added

- **registry**: Improved panic message when cloning a span whose ID
  doesn't exist, to aid in debugging issues with multiple subscribers
  ([#1483])
- **registry**: Improved documentation on span ID generation ([#1453])

Thanks to new contributors @joshtriplett and @lerouxgd, and returning
contributor @teozkr, for contributing to this release!

[#1460]: #1460
[#1483]: #1483
[#1463]: #1463
[#1453]: #1453
hawkw added a commit that referenced this pull request Aug 17, 2021
# 0.2.20 (August 17, 2021)

### Fixed

- **fmt**: Fixed `fmt` printing only the first `source` for errors with
  a chain of sources ([#1460])
- **fmt**: Fixed missing space between level and event in the `Pretty`
  formatter ([#1498])
- **json**: Fixed `Json` formatter not honoring `without_time` and
  `with_level` configurations ([#1463])

### Added

- **registry**: Improved panic message when cloning a span whose ID
  doesn't exist, to aid in debugging issues with multiple subscribers
  ([#1483])
- **registry**: Improved documentation on span ID generation ([#1453])

Thanks to new contributors @joshtriplett and @lerouxrgd, and returning
contributor @teozkr, for contributing to this release!

[#1460]: #1460
[#1483]: #1483
[#1463]: #1463
[#1453]: #1453
[#1498]: #1498
kaffarell pushed a commit to kaffarell/tracing that referenced this pull request May 22, 2024
# 0.2.20 (August 17, 2021)

### Fixed

- **fmt**: Fixed `fmt` printing only the first `source` for errors with
  a chain of sources ([tokio-rs#1460])
- **fmt**: Fixed missing space between level and event in the `Pretty`
  formatter ([tokio-rs#1498])
- **json**: Fixed `Json` formatter not honoring `without_time` and
  `with_level` configurations ([tokio-rs#1463])

### Added

- **registry**: Improved panic message when cloning a span whose ID
  doesn't exist, to aid in debugging issues with multiple subscribers
  ([tokio-rs#1483])
- **registry**: Improved documentation on span ID generation ([tokio-rs#1453])

Thanks to new contributors @joshtriplett and @lerouxrgd, and returning
contributor @teozkr, for contributing to this release!

[tokio-rs#1460]: tokio-rs#1460
[tokio-rs#1483]: tokio-rs#1483
[tokio-rs#1463]: tokio-rs#1463
[tokio-rs#1453]: tokio-rs#1453
[tokio-rs#1498]: tokio-rs#1498
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants