Enable colour in console output#896
Merged
josecelano merged 3 commits intotorrust:developfrom Jun 14, 2024
Merged
Conversation
To parse cargo logs.
It was disabled becuase parsing lgos to extract the services URLs was not working due to hidden color chars. This changes the parser to ignore color chars.
Member
Author
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #896 +/- ##
===========================================
+ Coverage 78.50% 78.53% +0.03%
===========================================
Files 171 171
Lines 9443 9458 +15
===========================================
+ Hits 7413 7428 +15
Misses 2030 2030 ☔ View full report in Codecov by Sentry. |
Member
Author
|
Regarding using tracing capabilities, for example, the folowwing Rust logging line: info!(target: "UDP TRACKER", "Started on: udp://{}", address);Produces this output: 2024-06-14T16:20:54.690047Z INFO UDP TRACKER: Started on: udp://0.0.0.0:6969But we could use instead: event!(target: "UDP TRACKER", Level::INFO, started_on_socket_address = format!("udp://{}", address.to_string()));Which produces: 2024-06-14T16:20:54.690052Z INFO UDP TRACKER: started_on_socket_address="udp://0.0.0.0:6969"I guess the second one is easier to parse: And it scales much better, we can add more fields. We have to research how this fits with new login styles like JSON format. cc @da2ce7 |
Member
Author
|
ACK eb928bc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Enable colour in console output.
We were using the
loggingcrate for logging. We move totracingbut keeping the same format for logs. The only difference was the colour introduced by thetracingcrate. This is just a patch to allow using color with tracing. We parse the logs to extract the running services for example from these lines:We extract these running services:
{ "udp_trackers": [ "127.0.0.1:6969" ], "http_trackers": [ "http://127.0.0.1:7070" ], "health_checks": [ "http://127.0.0.1:1313/health_check" ] }We should refactor the output format to take advantage of the new
tracingcrate.tracingsupports structured fields on spans and events, so it would be easier to parse those services.