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

Add logging for named threads and thread field padding #53

Merged
merged 1 commit into from Mar 28, 2020

Conversation

mulark
Copy link
Contributor

@mulark mulark commented Mar 26, 2020

Adds the ability to log the thread's name in place of the ID, also allows for a configurable padding setup.

@coveralls
Copy link

Coverage Status

Coverage increased (+1.9%) to 62.264% when pulling 82c9963 on mulark:master into a2fb655 on Drakulix:master.

@Drakulix Drakulix merged commit 39a5cb5 into Drakulix:master Mar 28, 2020
bors bot added a commit to probe-rs/probe-rs that referenced this pull request Jan 4, 2021
504: Update simplelog requirement from 0.8.0 to 0.9.0 in /probe-rs-cli-util r=Yatekii a=dependabot[bot]

Updates the requirements on [simplelog](https://github.com/drakulix/simplelog.rs) to permit the latest version.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/Drakulix/simplelog.rs/blob/master/CHANGELOG.md">simplelog's changelog</a>.</em></p>
<blockquote>
<h2>v0.9.0</h2>
<pre><code>- Add customizable level label colors (PR [#69](Drakulix/simplelog.rs#69). credits to @JarrettBillingsley)
- Remove unneeded TermLogError
- Future-proof config by adding `#[non_exhaustive]`
- Fix compiling with minimal-versions
</code></pre>
<h2>v0.8.0</h2>
<pre><code>- Switch from `term` to `termcolor` (PR [#59](Drakulix/simplelog.rs#59). credits to @raybritton)
- Fix typo in docs (PR [#58](Drakulix/simplelog.rs#58), credits to @anthonyjmartinez)
- Switch default padding to `Off`. Padding is annoyingly controversal, just set it to whatever you prefer, if you want it.
</code></pre>
<h2>v0.7.6</h2>
<pre><code>- Derive `Clone`,`Copy`,`PartialEq`,`Eq`,`Debug` and `Hash` for `TerminalMode`. (PR [#56](Drakulix/simplelog.rs#56), credits to @panhania)
</code></pre>
<h2>v0.7.5</h2>
<pre><code>- Use `target()` instead of `module_path()` for filtering as suggested by `log`s docs. (PR [#52](Drakulix/simplelog.rs#52), credits to @tsidea)
- Allow logging thread names and pad thread ids (defaults match the old behaviour). (PR [#53](Drakulix/simplelog.rs#53), credits to @mulark)
</code></pre>
<h2>v0.7.4</h2>
<pre><code>- Fixed time formats with 
</code></pre>
<h2>v0.7.3</h2>
<pre><code>- Fixed `test` feature
</code></pre>
<h2>v0.7.2</h2>
<pre><code>- Allow Level Padding to be configured
</code></pre>
<h2>v0.7.1</h2>
<pre><code>- Fix `LevelFilter:Off` not turning off parts of the log messages
</code></pre>
<h2>v0.7.0</h2>
<pre><code>- Add local time zone option
- Change config to builder pattern avoiding future major version bumps
- Add further documentation about dealing with `TermLogger` failing
- `term` 0.6.* is now also supported
</code></pre>
<h2>v0.6.0</h2>
<pre><code>- Add time offset parameter (defaults to UTC)
- Add thread_id output (credits to @kurtlawrence)
- Pad log level
- Add TestLogger (credits to @AlexW-GH)
- Add stream configuration to TermLogger
- Implement allow- and ignore-filtering (credits to @ryankurte)
</code></pre>
<h2>v0.5.3</h2>
<pre><code>- Fix minimal chrono version / update to chrono v0.4.1 (PR [#27](Drakulix/simplelog.rs#27), credits to @samueltardieu)
</code></pre>
<h2>v0.5.2</h2>
<pre><code>- Don't interleave stdout and stderr (PR [#23](Drakulix/simplelog.rs#23), credits to @hansjorg)
</code></pre>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/Drakulix/simplelog.rs/commit/8338b80979bcae391a8c5bc61f13e174bc118cb2"><code>8338b80</code></a> v0.9.0</li>
<li><a href="https://github.com/Drakulix/simplelog.rs/commit/1a1a2884cf8e85cdba6a826f304a088080444a89"><code>1a1a288</code></a> Add test for minimal-versions to travis</li>
<li><a href="https://github.com/Drakulix/simplelog.rs/commit/2f10cd1c358db563c07986c530b8a228ae0813d1"><code>2f10cd1</code></a> Fix -Z minimal-versions</li>
<li><a href="https://github.com/Drakulix/simplelog.rs/commit/1c172f6a09676e7d24eca083bf03a99ac05b93c4"><code>1c172f6</code></a> Future-proof config by requiring ..Default::default()</li>
<li><a href="https://github.com/Drakulix/simplelog.rs/commit/d9b78aed7ba557461053aa2cba9096562bc173d8"><code>d9b78ae</code></a> Remove unneeded TermLogError</li>
<li><a href="https://github.com/Drakulix/simplelog.rs/commit/bfb70b80233f9704482e3bf24fa49b4b796e1af5"><code>bfb70b8</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/drakulix/simplelog.rs/issues/69">#69</a> from JarrettBillingsley/master</li>
<li><a href="https://github.com/Drakulix/simplelog.rs/commit/2e6e990983857cde7d07fa5faea7405afb30ddd7"><code>2e6e990</code></a> added <code>ConfigBuilder::set_level_color</code> to customize the colors of level label...</li>
<li><a href="https://github.com/Drakulix/simplelog.rs/commit/195361ccb8442a2f0a8ea2e40fdce6223d0cf0fa"><code>195361c</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/drakulix/simplelog.rs/issues/60">#60</a> from rubenvandeven/master</li>
<li><a href="https://github.com/Drakulix/simplelog.rs/commit/0ab41767e2b060013b7dc3fe4dd6661ab3b5b5e5"><code>0ab4176</code></a> Remove unwrap() on TermLogger::new() in README.</li>
<li>See full diff in <a href="https://github.com/drakulix/simplelog.rs/compare/v0.8.0...v0.9.0">compare view</a></li>
</ul>
</details>
<br />


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
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
bors bot added a commit to probe-rs/probe-rs that referenced this pull request Apr 28, 2021
588: Update simplelog requirement from 0.9.0 to 0.10.0 in /probe-rs-cli-util r=Yatekii a=dependabot[bot]

Updates the requirements on [simplelog](https://github.com/drakulix/simplelog.rs) to permit the latest version.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/Drakulix/simplelog.rs/blob/master/CHANGELOG.md">simplelog's changelog</a>.</em></p>
<blockquote>
<h2>v0.10.0</h2>
<pre><code>- Fix wrong argument naming (PR [#70](Drakulix/simplelog.rs#70), credits to @scvalex)
- *Breaking*: More color customization options (PR [#72](Drakulix/simplelog.rs#72), credits to @mrkline)
- Clarify docs on config levels
</code></pre>
<h2>v0.9.0</h2>
<pre><code>- Add customizable level label colors (PR [#69](Drakulix/simplelog.rs#69). credits to @JarrettBillingsley)
- Remove unneeded TermLogError
- Future-proof config by adding `#[non_exhaustive]`
- Fix compiling with minimal-versions
</code></pre>
<h2>v0.8.0</h2>
<pre><code>- Switch from `term` to `termcolor` (PR [#59](Drakulix/simplelog.rs#59). credits to @raybritton)
- Fix typo in docs (PR [#58](Drakulix/simplelog.rs#58), credits to @anthonyjmartinez)
- Switch default padding to `Off`. Padding is annoyingly controversal, just set it to whatever you prefer, if you want it.
</code></pre>
<h2>v0.7.6</h2>
<pre><code>- Derive `Clone`,`Copy`,`PartialEq`,`Eq`,`Debug` and `Hash` for `TerminalMode`. (PR [#56](Drakulix/simplelog.rs#56), credits to @panhania)
</code></pre>
<h2>v0.7.5</h2>
<pre><code>- Use `target()` instead of `module_path()` for filtering as suggested by `log`s docs. (PR [#52](Drakulix/simplelog.rs#52), credits to @tsidea)
- Allow logging thread names and pad thread ids (defaults match the old behaviour). (PR [#53](Drakulix/simplelog.rs#53), credits to @mulark)
</code></pre>
<h2>v0.7.4</h2>
<pre><code>- Fixed time formats with 
</code></pre>
<h2>v0.7.3</h2>
<pre><code>- Fixed `test` feature
</code></pre>
<h2>v0.7.2</h2>
<pre><code>- Allow Level Padding to be configured
</code></pre>
<h2>v0.7.1</h2>
<pre><code>- Fix `LevelFilter:Off` not turning off parts of the log messages
</code></pre>
<h2>v0.7.0</h2>
<pre><code>- Add local time zone option
- Change config to builder pattern avoiding future major version bumps
- Add further documentation about dealing with `TermLogger` failing
- `term` 0.6.* is now also supported
</code></pre>
<h2>v0.6.0</h2>
<pre><code>- Add time offset parameter (defaults to UTC)
- Add thread_id output (credits to @kurtlawrence)
- Pad log level
- Add TestLogger (credits to @AlexW-GH)
- Add stream configuration to TermLogger
- Implement allow- and ignore-filtering (credits to @ryankurte)
</code></pre>
<h2>v0.5.3</h2>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/Drakulix/simplelog.rs/commit/1d26f67c78d01f33de460b0f3e7b82863e98f743"><code>1d26f67</code></a> ci: fix tag regex</li>
<li><a href="https://github.com/Drakulix/simplelog.rs/commit/f3603e6fbfe62803554d19553d420510512e23dd"><code>f3603e6</code></a> v0.10.0</li>
<li><a href="https://github.com/Drakulix/simplelog.rs/commit/5d077b6e1abe5bfa97010b5e8f305f56a43859c5"><code>5d077b6</code></a> Use sensible workflow name</li>
<li><a href="https://github.com/Drakulix/simplelog.rs/commit/577a532d82e3325b553e5935cfbf246c2a2e211b"><code>577a532</code></a> Fix some unused imports when disabling default features</li>
<li><a href="https://github.com/Drakulix/simplelog.rs/commit/e741dd89f1a90a1730a10d38f9c6ce4a992056d3"><code>e741dd8</code></a> fix clippy lints</li>
<li><a href="https://github.com/Drakulix/simplelog.rs/commit/33c8ac922de1bcaf1f7cec61ae98001d600389d5"><code>33c8ac9</code></a> ci: fix minimal versions</li>
<li><a href="https://github.com/Drakulix/simplelog.rs/commit/e35d430e03779e1b2c2c35a3a922f93d32526a68"><code>e35d430</code></a> cargo fmt</li>
<li><a href="https://github.com/Drakulix/simplelog.rs/commit/951fab7ae340ead4c36d40b2f7d87f38d594dee3"><code>951fab7</code></a> typo</li>
<li><a href="https://github.com/Drakulix/simplelog.rs/commit/307777ac78ef302839c074a3b703bfaadfdde9ab"><code>307777a</code></a> Switch to github-actions</li>
<li><a href="https://github.com/Drakulix/simplelog.rs/commit/d1e80a2c6669c28e9809dd7d952fdeee0da7fd5c"><code>d1e80a2</code></a> Clarify config levels documentation</li>
<li>Additional commits viewable in <a href="https://github.com/drakulix/simplelog.rs/compare/v0.9.0...v0.10.0">compare view</a></li>
</ul>
</details>
<br />


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
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
bors bot added a commit to probe-rs/probe-rs that referenced this pull request Nov 15, 2021
887: build(deps): update simplelog requirement from 0.10.0 to 0.11.0 in /probe-rs-cli-util r=Yatekii a=dependabot[bot]

Updates the requirements on [simplelog](https://github.com/drakulix/simplelog.rs) to permit the latest version.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/Drakulix/simplelog.rs/blob/master/CHANGELOG.md">simplelog's changelog</a>.</em></p>
<blockquote>
<h2>v0.11.0</h2>
<pre><code>- Add colored log levels using `ansi_term` (PR [#88](Drakulix/simplelog.rs#88), credits to `@manio)`
- Add target padding (PR [#85](Drakulix/simplelog.rs#85), credits to `@bytebeamio)`
- Add optional color and style support using `paris` crate (PR [#84](Drakulix/simplelog.rs#84), credits to `@manio)`
</code></pre>
<h2>v0.10.2</h2>
<pre><code>- Fix flushing with `BufferedStandardStreams` (PR [#82](Drakulix/simplelog.rs#82), credits to `@mrkline)`
</code></pre>
<h2>v0.10.1</h2>
<pre><code>- Fix TermLogger performance using `termcolor::BufferedStandardStream` (PR [#80](Drakulix/simplelog.rs#80), credits to `@mrkline)`
- Add write thread name support for `termlog` (PR [#76](Drakulix/simplelog.rs#76), credits to `@zeroflaw)`
</code></pre>
<h2>v0.10.0</h2>
<pre><code>- Fix wrong argument naming (PR [#70](Drakulix/simplelog.rs#70), credits to `@scvalex)`
- *Breaking*: More color customization options (PR [#72](Drakulix/simplelog.rs#72), credits to `@mrkline)`
- Clarify docs on config levels
</code></pre>
<h2>v0.9.0</h2>
<pre><code>- Add customizable level label colors (PR [#69](Drakulix/simplelog.rs#69). credits to `@JarrettBillingsley)`
- Remove unneeded TermLogError
- Future-proof config by adding `#[non_exhaustive]`
- Fix compiling with minimal-versions
</code></pre>
<h2>v0.8.0</h2>
<pre><code>- Switch from `term` to `termcolor` (PR [#59](Drakulix/simplelog.rs#59). credits to `@raybritton)`
- Fix typo in docs (PR [#58](Drakulix/simplelog.rs#58), credits to `@anthonyjmartinez)`
- Switch default padding to `Off`. Padding is annoyingly controversal, just set it to whatever you prefer, if you want it.
</code></pre>
<h2>v0.7.6</h2>
<pre><code>- Derive `Clone`,`Copy`,`PartialEq`,`Eq`,`Debug` and `Hash` for `TerminalMode`. (PR [#56](Drakulix/simplelog.rs#56), credits to `@panhania)`
</code></pre>
<h2>v0.7.5</h2>
<pre><code>- Use `target()` instead of `module_path()` for filtering as suggested by `log`s docs. (PR [#52](Drakulix/simplelog.rs#52), credits to `@tsidea)`
- Allow logging thread names and pad thread ids (defaults match the old behaviour). (PR [#53](Drakulix/simplelog.rs#53), credits to `@mulark)`
</code></pre>
<h2>v0.7.4</h2>
<pre><code>- Fixed time formats with 
</code></pre>
<h2>v0.7.3</h2>
<pre><code>- Fixed `test` feature
</code></pre>
<h2>v0.7.2</h2>
<pre><code>- Allow Level Padding to be configured
</code></pre>
<h2>v0.7.1</h2>
<pre><code>- Fix `LevelFilter:Off` not turning off parts of the log messages
</code></pre>
<h2>v0.7.0</h2>
<pre><code>- Add local time zone option
- Change config to builder pattern avoiding future major version bumps
</code></pre>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/Drakulix/simplelog.rs/commit/ddd6e694b8b5699e04ef20cc6dbb1bbeeeb5041a"><code>ddd6e69</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/drakulix/simplelog.rs/issues/86">#86</a> from manio/master</li>
<li><a href="https://github.com/Drakulix/simplelog.rs/commit/e0585753a1717f0b37aa8ce6f37889f8a985d52c"><code>e058575</code></a> Update CHANGELOG.md</li>
<li><a href="https://github.com/Drakulix/simplelog.rs/commit/a90ab8a14ae346945ee2f449df515d0182921d9e"><code>a90ab8a</code></a> Bump version to v0.11.0 and adjust README</li>
<li><a href="https://github.com/Drakulix/simplelog.rs/commit/cc590d2a364433e4fcc940e16213699de1dd873d"><code>cc590d2</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/drakulix/simplelog.rs/issues/88">#88</a> from manio/level-colorize</li>
<li><a href="https://github.com/Drakulix/simplelog.rs/commit/cda775724849ff11ac2549723496b1afa7b8a737"><code>cda7757</code></a> config: make set_write_log_enable_colors() an ansi_term feature dependant</li>
<li><a href="https://github.com/Drakulix/simplelog.rs/commit/3e0b33649dc9b3bfb6f01b724c9e3c5cfadaba45"><code>3e0b336</code></a> paris_macros: fix <code>this URL is not a hyperlink</code> warnings</li>
<li><a href="https://github.com/Drakulix/simplelog.rs/commit/feb3458fb455f357e7fbcd108d022eb7f712977f"><code>feb3458</code></a> Add a write_log_enable_colors configuration switch</li>
<li><a href="https://github.com/Drakulix/simplelog.rs/commit/1f76fd5a5bddc242eabf98c074a206bca0eff17e"><code>1f76fd5</code></a> introduce colored log levels using ansi_term</li>
<li><a href="https://github.com/Drakulix/simplelog.rs/commit/f41c17969660c2dadc7f2644700c94ea7a649458"><code>f41c179</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/drakulix/simplelog.rs/issues/85">#85</a> from bytebeamio/modulepad</li>
<li><a href="https://github.com/Drakulix/simplelog.rs/commit/09da042e5c5eced2781fa0e051314d814b38582a"><code>09da042</code></a> Remove modulepad example</li>
<li>Additional commits viewable in <a href="https://github.com/drakulix/simplelog.rs/compare/v0.10.0...v0.11.0">compare view</a></li>
</ul>
</details>
<br />


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
- ``@dependabot` ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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.

None yet

3 participants