-
Notifications
You must be signed in to change notification settings - Fork 0
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
Logging improvements (Node definition overhaul) #13
Merged
Conversation
This file contains 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
✅ Deploy Preview for zio-maelstrom ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
bilal-fazlani
force-pushed
the
logging-improvements
branch
2 times, most recently
from
February 27, 2024 09:44
31fc5f8
to
68364e0
Compare
bilal-fazlani
changed the title
Logging improvements
Logging improvements (Node definition overhaul)
Feb 27, 2024
.red was used at wrong place
and remove `provideRemaining` method
bilal-fazlani
force-pushed
the
logging-improvements
branch
from
February 27, 2024 17:18
55585f9
to
7346186
Compare
error type and return type are both Unit now
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.
The logger currently is a custom implementation and a layer inside MaelstromRuntime. The apis to use logging methods are exposed at top level.
When there is an unhandled error, ZIO's runtime logs it using ZIO's default logger which prints data on STDOUT. This is breaks maelstrom because it uses STDOUT and network IO and can't makes sense of this log.
Also, one thought is - it does not makes sense to have another logging interface for ZIO-Maelstrom when ZIO does provides a native interface.
Somehow, we need to create logger extending ZIO's interface and provide an easy mechanism to replace default logger with Maelstrom logger.
Tasks
Update: 27 Feb 2024
Using a custom logger as ZIO logger requires overriding bootstrap method in a ZIO app. Overriding was not possible in the older approach there was no parent class to extend from. So this turned out to be a lot bigger change than expected. I had to change the Node definition approach from a simple ZIO effect to an object which extends from a new trait called
MaelstromNode
. Extending this trait now installs the newZIOMaelstromLogger
. BecauselogLevel
andlogFormat
were part of settings which was part of layer construction, I also had to break that down make it into an overridable val/def.