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

Update fmt-multiple-writers.rs example #3139

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kadenlnelson
Copy link

@kadenlnelson kadenlnelson commented Nov 18, 2024

Motivation

Related #3116

A common use-case is to write colored (ANSI) logs to stdout and write non-colored logs to a file. Where that file may be forwarded to an aggregator, or viewed in an editor, which expects the contents to not have color formatting.

Solution

This PR updates the fmt-multiple-writers.rs example to demonstrate this use-case.

One additional change that's not related to what's described above is the printing of the log file contents to stdout after the example has finished shaving Yaks. The motive being that the log file TempDir is dropped after the example has finished. Currently, the end-user doesn't have a way to inspect the contents of the file without hopping into a debugger, modifying the example, or writing the file to a path that persists after execution.

Example Output

Screenshot 2024-11-17 at 11 42 33 PM

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.

1 participant