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

feat: Switch prints to tracing #55

Merged
merged 5 commits into from
Jan 12, 2022
Merged

feat: Switch prints to tracing #55

merged 5 commits into from
Jan 12, 2022

Conversation

itegulov
Copy link
Contributor

@itegulov itegulov commented Jan 12, 2022

Fixes #26

I chose tracing since this is what nearcore is using and due to its extensive features such as layered spans and subscription mechanisms that can be useful for monitoring further down the line. As per conversation under the issue, it does not necessarily tie us to tokio ecosystem either.

Unfortunately, the sandbox logs are being produced by a dynamically downloaded binary file, so they do not respect the logging configuration (RUST_LOG, RUST_LOG_STYLE and others). See #53. This means that for now users will see logs being printed in an inconsistent manner like this:

2022-01-12T01:05:05.814561Z  INFO workspaces: Starting up sandbox at localhost:15562
2022-01-12T01:05:05.814601Z  INFO workspaces: Starting up sandbox at localhost:15965
Jan 12 12:05:05.817  INFO neard: Version: trunk, Build: 2c9375ee, Latest Protocol: 48
Jan 12 12:05:05.817  INFO neard: Version: trunk, Build: 2c9375ee, Latest Protocol: 48
Jan 12 12:05:05.817  INFO near: Generated node key, validator key, genesis file in /tmp/sandbox-15965
Jan 12 12:05:05.817  INFO near: Generated node key, validator key, genesis file in /tmp/sandbox-15562
2022-01-12T01:05:05.817696Z  INFO workspaces: Started sandbox: pid=12175
2022-01-12T01:05:05.817866Z  INFO workspaces: Started sandbox: pid=12176

@itegulov
Copy link
Contributor Author

Also, I have not touched any of the examples, but it might be good idea to refactor at least one (or all?) of them to show that workspaces can be used with either log or tracing. @ChaoticTempest WDYT?

workspaces/Cargo.toml Outdated Show resolved Hide resolved
Co-authored-by: Austin Abell <austinabell8@gmail.com>
@ChaoticTempest
Copy link
Member

it might be good idea to refactor at least one (or all?) of them to show that workspaces can be used with either

@itegulov Definitely a good idea, wanna try refactoring the spooning example? There's only a couple of println calls in there

@itegulov
Copy link
Contributor Author

@ChaoticTempest Done!

@ChaoticTempest ChaoticTempest merged commit 5e5d926 into main Jan 12, 2022
@ChaoticTempest ChaoticTempest deleted the daniyar/logging branch January 12, 2022 19:53
@frol frol mentioned this pull request Oct 4, 2023
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.

Switch prints to actual logging solution
3 participants