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

[refactoring] Evaluate frequent usage of zap.Fatal() #163

Open
theurichde opened this issue Jan 15, 2024 · 0 comments
Open

[refactoring] Evaluate frequent usage of zap.Fatal() #163

theurichde opened this issue Jan 15, 2024 · 0 comments
Labels
enhancement New feature or request go Pull requests that update Go code

Comments

@theurichde
Copy link
Owner

tl;dr: usage of zap.Fatal() is hard for testing.

the root problem here is the frequent use of zap.Fatal() through the application code. This causes the test execution process to immediately terminate without collecting failure logging when any application error occurs. Since the zap logger is not initialized for test runs, it is difficult to see where the problem is happening without debugging. Debugging is hard since it worked 100% of the time on my machine, only failing in the GitLab Actions.

Referring to #160

Implementation

  • Wrap zap logger initialization in an interface or factory
    • enables overriding Fatal() to log the stack trace and not exit in tests
@theurichde theurichde added enhancement New feature or request good first issue Good for newcomers go Pull requests that update Go code labels Jan 15, 2024
@theurichde theurichde removed the good first issue Good for newcomers label May 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request go Pull requests that update Go code
Projects
None yet
Development

No branches or pull requests

1 participant