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 different error handling behaviors for disk writing errors #75

Merged
merged 1 commit into from
Jan 29, 2023

Conversation

KaiOelfke
Copy link
Contributor

I was using Puppy during debugging a low disk space scenario. One crash was actually a side effect of logging with Puppy. The disk write failed due to low disk space. Using force trying to log is not always the right behavior for each logging use case.

Screenshot 2023-01-24 at 09 59 29

For this scenario it's better to potentially lose some logs than to crash the app.

This PR adds two more error handling strategies for disk writes. There may be other valid error handling strategies.

  • assert uses assertionFailure to stop execution for debug builds and ignores failures in release builds
  • print only prints the error message to the standard output

The default option force has the current behavior. So this shouldn't be a breaking change, but allows Puppy users to pick a different behavior, when useful.

For example when logging during a low disk space scenario it may be preferable to lose logs over crashing the app.
@sushichop
Copy link
Owner

@KaiOelfke
This use case is very helpful.
Thanks for your excellent pull request!

@sushichop sushichop merged commit 5b2ad46 into sushichop:main Jan 29, 2023
sushichop added a commit that referenced this pull request Jan 30, 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.

2 participants