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

subscriber: fix extra padding in pretty format #1275

Merged
merged 4 commits into from
Mar 11, 2021

Conversation

lenaschoenburg
Copy link
Contributor

@lenaschoenburg lenaschoenburg commented Mar 2, 2021

Motivation

This fixes #1212, where extra padding was written when logging with the
pretty formatter.

Solution

With this change we only write padding when we actually decide to write
a value but not when skipping a metadata value such as log.file or
log.line

This fixes tokio-rs#1212 where extra padding was written when logging with
metadata. With this change we only write padding when we actually
decide to write a value, not when skipping a metadata value.
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.

thank you for fixing this, this looks great! <3

i'll backport this to v0.1.x once it merges so that we can get it in the next release.

tracing-subscriber/src/fmt/format/pretty.rs Outdated Show resolved Hide resolved
Co-authored-by: Eliza Weisman <eliza@buoyant.io>
@lenaschoenburg
Copy link
Contributor Author

Tests are failing due to bheisler/TinyTemplate#16

@hawkw hawkw merged commit 6beb7f9 into tokio-rs:master Mar 11, 2021
hawkw pushed a commit that referenced this pull request Mar 12, 2021
## Motivation

This fixes #1212, where extra padding was written when logging with the
pretty formatter.

## Solution 

With this change we only write padding when we actually decide to write
a value but not when skipping a metadata value such as `log.file` or
`log.line`
hawkw pushed a commit that referenced this pull request Mar 12, 2021
## Motivation

This fixes #1212, where extra padding was written when logging with the
pretty formatter.

## Solution 

With this change we only write padding when we actually decide to write
a value but not when skipping a metadata value such as `log.file` or
`log.line`
hawkw added a commit that referenced this pull request Mar 12, 2021
# 0.2.17 (March 12, 2020)

### Fixed

- **fmt**: `Pretty` formatter now honors `with_ansi(false)` to disable
  ANSI terminal formatting ([#1240])
- **fmt**: Fixed extra padding when using `Pretty` formatter ([#1275])
- **chrono**: Removed extra trailing space with `ChronoLocal` time
  formatter ([#1103])

### Added

- **fmt**: Added `FmtContext::current_span()` method, returning the
  current span
  ([#1290])
- **fmt**: `FmtSpan` variants may now be combined using the `|` operator
  for more granular control over what span events are generated
  ([#1277])

Thanks to new contributors @cratelyn, @dignati, and @zicklag, as well as
@Folyd, @matklad, and @najamelan, for contributing to this release!
hawkw added a commit that referenced this pull request Mar 12, 2021
# 0.2.17 (March 12, 2020)

### Fixed

- **fmt**: `Pretty` formatter now honors `with_ansi(false)` to disable
  ANSI terminal formatting ([#1240])
- **fmt**: Fixed extra padding when using `Pretty` formatter ([#1275])
- **chrono**: Removed extra trailing space with `ChronoLocal` time
  formatter ([#1103])

### Added

- **fmt**: Added `FmtContext::current_span()` method, returning the
  current span
  ([#1290])
- **fmt**: `FmtSpan` variants may now be combined using the `|` operator
  for more granular control over what span events are generated
  ([#1277])

Thanks to new contributors @cratelyn, @dignati, and @zicklag, as well as
@Folyd, @matklad, and @najamelan, for contributing to this release!

[#1240]: #1240
[#1275]: #1275
[#1103]: #1103
[#1290]: #1290
[#1277]: #1277
@lenaschoenburg lenaschoenburg deleted the fix-pretty-with-log-meta branch March 13, 2021 12:48
This was referenced Mar 15, 2021
bors bot referenced this pull request in comit-network/comit-rs Mar 17, 2021
3532: Bump tracing-subscriber from 0.2.15 to 0.2.17 r=mergify[bot] a=dependabot[bot]

Bumps [tracing-subscriber](https://github.com/tokio-rs/tracing) from 0.2.15 to 0.2.17.
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/tokio-rs/tracing/commit/88685417f66ae7b74df57f56ebe28256dc9fd7ff"><code>8868541</code></a> subscriber: prepare to release 0.2.17 (<a href="https://github.com/tokio-rs/tracing/issues/1302">#1302</a>)</li>
<li><a href="https://github.com/tokio-rs/tracing/commit/742b21461bffc59c60ba4d5726e752144b3fffc3"><code>742b214</code></a> attributes: prepare to release v0.1.15 (<a href="https://github.com/tokio-rs/tracing/issues/1301">#1301</a>)</li>
<li><a href="https://github.com/tokio-rs/tracing/commit/ec7313466dbe615ed8397422bc0aa34280dec0a6"><code>ec73134</code></a> subscriber: update pretty formatter for no ansi (<a href="https://github.com/tokio-rs/tracing/issues/1240">#1240</a>)</li>
<li><a href="https://github.com/tokio-rs/tracing/commit/a947c5a63f73b840d100ee85638e90a3488f9789"><code>a947c5a</code></a> subscriber: change <code>FmtSpan</code> to a combinable bitflag (<a href="https://github.com/tokio-rs/tracing/issues/1277">#1277</a>)</li>
<li><a href="https://github.com/tokio-rs/tracing/commit/f3eb5ccf2dc128ef171a2320bff488c144903376"><code>f3eb5cc</code></a> subscriber: fix extra padding in pretty format (<a href="https://github.com/tokio-rs/tracing/issues/1275">#1275</a>)</li>
<li><a href="https://github.com/tokio-rs/tracing/commit/ac0aa9763b434885bba27db7334683c0e5665e97"><code>ac0aa97</code></a> attributes: fix <code>#[instrument]</code> skipping code when returning pinned futures (...</li>
<li><a href="https://github.com/tokio-rs/tracing/commit/544da6b5d8b489cee084974100514e38fe25b6ec"><code>544da6b</code></a> subscriber: Add a public <code>current_span()</code> method for <code>FmtContext</code> (<a href="https://github.com/tokio-rs/tracing/issues/1290">#1290</a>)</li>
<li><a href="https://github.com/tokio-rs/tracing/commit/14d11ebdd60db0955806d10d31345a54a79a38f7"><code>14d11eb</code></a> subscriber: remove unnecessary transparent attribute (<a href="https://github.com/tokio-rs/tracing/issues/1282">#1282</a>)</li>
<li><a href="https://github.com/tokio-rs/tracing/commit/51812267b8af46244c412cf0490391d024e60902"><code>5181226</code></a> subscriber: use struct update syntax when constructing from <code>self</code> (<a href="https://github.com/tokio-rs/tracing/issues/1289">#1289</a>)</li>
<li><a href="https://github.com/tokio-rs/tracing/commit/6f9b537c2ebbfb73c57b5c40dc25e011eb1b4d7c"><code>6f9b537</code></a> subscriber: Remove trailing space from ChronoLocal time formatter. (<a href="https://github.com/tokio-rs/tracing/issues/1103">#1103</a>)</li>
<li>Additional commits viewable in <a href="https://github.com/tokio-rs/tracing/compare/tracing-subscriber-0.2.15...tracing-subscriber-0.2.17">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=tracing-subscriber&package-manager=cargo&previous-version=0.2.15&new-version=0.2.17)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually


</details>

3533: Bump socket2 from 0.3.19 to 0.4.0 r=mergify[bot] a=dependabot[bot]

Bumps [socket2](https://github.com/rust-lang/socket2) from 0.3.19 to 0.4.0.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/rust-lang/socket2/blob/master/CHANGELOG.md">socket2's changelog</a>.</em></p>
<blockquote>
<h1>0.4.0</h1>
<h2>Added</h2>
<ul>
<li>New <code>all</code> feature: enables API that is not available on all tier 1 platforms.</li>
<li><code>SockRef</code> type: used to create a reference to an existing socket, e.g.
<code>std::net::TcpStream</code>, making all methods of <code>Socket</code> available on it.</li>
<li>Support for vectored I/O:
<ul>
<li><code>Socket::recv_vectored</code>, <code>Socket::recv_with_flags</code>.</li>
<li><code>Socket::recv_from_vectored</code>, <code>Socket::recv_from_vectored_with_flags</code>.</li>
<li><code>Socket::send_vectored</code>, <code>Socket::send_vectored_with_flags</code>.</li>
<li><code>Socket::send_to_vectored</code>, <code>Socket::send_to_vectored_with_flags</code>.</li>
<li>In the <code>Read</code> and <code>Write</code> implementations.</li>
</ul>
</li>
<li><code>Socket::new_raw</code>, <code>Socket::pair_raw</code> and <code>Socket::accept_raw</code> methods
that don't set common flags, such as the close-on-exec flag.</li>
<li><code>Socket::accept4</code>: <code>accept4(2)</code> system call.</li>
<li><code>Socket::sendfile</code>: the <code>sendfile(2)</code> system call.</li>
<li><code>Socket::set_cloexec</code>: set the close-on-exec flag on Unix.</li>
<li><code>Socket::set_no_inherit</code>: set inherit handle flag on Windows.</li>
<li><code>Socket::set_nosigpipe</code>: set <code>SO_NOSIGPIPE</code> on Apple targets.</li>
<li><code>Socket::set_mark</code> and <code>Socket::mark</code>, setting/getting the <code>SO_MARK</code> socket
option.</li>
<li><code>Socket::set_cpu_affinity</code> and <code>Socket::cpu_affinity</code>, setting/getting the
<code>SO_INCOMING_CPU</code> socket option.</li>
<li><code>Socket::set_mss</code> and <code>Socket::mss</code>, setting/getting the <code>TCP_MAXSEG</code> socket
option.</li>
<li><code>Socket::set_freebind</code> and <code>Socket::freebind</code>, setting/getting the
<code>IP_FREEBIND</code> socket option.</li>
<li><code>Socket::bind_device</code> and <code>Socket::device</code>, setting/getting the
<code>SO_BINDTODEVICE</code> socket option.</li>
<li>Adopted Mio's TCP keepalive API:
<ul>
<li><code>Socket::keepalive_time</code>,</li>
<li><code>Socket::keepalive_interval</code>,</li>
<li><code>Socket::keepalive_retries</code>,</li>
<li><code>Socket::set_tcp_keepalive</code>.</li>
</ul>
</li>
<li><code>Socket::is_listener</code> getting the <code>SO_ACCEPTCONN</code> socket option.</li>
<li><code>Socket::domain</code> getting the <code>SO_DOMAIN</code> socket option.</li>
<li><code>Socket::protocol</code> getting the <code>SO_PROTOCOL</code> socket option.</li>
<li><code>Socket::type</code> getting the <code>SO_TYPE</code> socket option.</li>
<li><code>Domain::for_address</code>: the correct <code>Domain</code> for a <code>std::net::SocketAddr</code>.</li>
<li><code>Type::nonblocking</code>: set <code>SOCK_NONBLOCK</code>.</li>
<li><code>Type::cloexec</code>: set <code>SOCK_CLOEXEC</code>.</li>
<li><code>Type::no_inherit</code>: set <code>HANDLE_FLAG_INHERIT</code>.</li>
<li><code>SockAddr::init</code>: initialises a <code>SockAddr</code>.</li>
<li><code>MaybeUninitSlice</code> type: a version of <code>IoSliceMut</code> that allows the buffer to
be uninitialised, used in <code>Socket::recv_vectored</code> and related functions.</li>
<li><code>RecvFlags</code> type: provides additional information about incoming messages,
returned by <code>Socket::recv_vectored</code> and related functions.</li>
<li><code>TcpKeepalive</code> type: configuration type for a socket's TCP keepalive
parameters.</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/rust-lang/socket2/commit/b1479fffa0749147eabd15ad9038d0f9a0cc7825"><code>b1479ff</code></a> Release v0.4.0</li>
<li><a href="https://github.com/rust-lang/socket2/commit/adf32dabfc5c152af8488161b1d99512c8b8b054"><code>adf32da</code></a> Use SO_LINGER_SEC for Socket::get/set_linger on macOS</li>
<li><a href="https://github.com/rust-lang/socket2/commit/559ba4290899002406bb4c89caef7905a186ba0a"><code>559ba42</code></a> Fuchsia doesn't support <code>sendfile</code></li>
<li><a href="https://github.com/rust-lang/socket2/commit/94c32b95921c13740abfa8a109acc821a4f2ed05"><code>94c32b9</code></a> Release v0.4.0-alpha.5</li>
<li><a href="https://github.com/rust-lang/socket2/commit/ca694de9a75f52607693704dc0fa6fa7573b089d"><code>ca694de</code></a> Change Socket::(set_)cpu_affinity to take an immutable reference</li>
<li><a href="https://github.com/rust-lang/socket2/commit/4f643fc66fd6ab52d86477a6d93dd04dd209115a"><code>4f643fc</code></a> Release v0.4.0-alpha.4</li>
<li><a href="https://github.com/rust-lang/socket2/commit/c3b447e1597886fc81c12ba108201944235569b1"><code>c3b447e</code></a> Add Socket::(set_)cpu_affinity</li>
<li><a href="https://github.com/rust-lang/socket2/commit/33da3507f8e5205f7a66654b8349aec112447ef6"><code>33da350</code></a> Release v0.4.0-alpha.3</li>
<li><a href="https://github.com/rust-lang/socket2/commit/4f22376fc1fba8062f756e2c4f4bdf7d05ede5a9"><code>4f22376</code></a> tests: add vsock test</li>
<li><a href="https://github.com/rust-lang/socket2/commit/07c7b373615e1011f51e79269960d72fe006f089"><code>07c7b37</code></a> unix: add SockAddr::vsock_address()</li>
<li>Additional commits viewable in <a href="https://github.com/rust-lang/socket2/compare/v0.3.19...v0.4.0">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=socket2&package-manager=cargo&previous-version=0.3.19&new-version=0.4.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually


</details>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
kaffarell pushed a commit to kaffarell/tracing that referenced this pull request May 22, 2024
# 0.2.17 (March 12, 2020)

### Fixed

- **fmt**: `Pretty` formatter now honors `with_ansi(false)` to disable
  ANSI terminal formatting ([tokio-rs#1240])
- **fmt**: Fixed extra padding when using `Pretty` formatter ([tokio-rs#1275])
- **chrono**: Removed extra trailing space with `ChronoLocal` time
  formatter ([tokio-rs#1103])

### Added

- **fmt**: Added `FmtContext::current_span()` method, returning the
  current span
  ([tokio-rs#1290])
- **fmt**: `FmtSpan` variants may now be combined using the `|` operator
  for more granular control over what span events are generated
  ([tokio-rs#1277])

Thanks to new contributors @cratelyn, @dignati, and @zicklag, as well as
@Folyd, @matklad, and @najamelan, for contributing to this release!

[tokio-rs#1240]: tokio-rs#1240
[tokio-rs#1275]: tokio-rs#1275
[tokio-rs#1103]: tokio-rs#1103
[tokio-rs#1290]: tokio-rs#1290
[tokio-rs#1277]: tokio-rs#1277
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.

Pretty formatter adds a bunch of commas at the end of output and does not display levels
2 participants