terramate icon indicating copy to clipboard operation
terramate copied to clipboard

chore: generate Go boilerplate to disable logging in tests.

Open i4ki opened this issue 4 months ago • 4 comments

What this PR does / why we need it:

By default we disable logging by calling zerolog.SetGlobalLevel(zerolog.Disabled) in the init() function of a test file. There's no consistency and sometimes it's done inside an specific test file and sometimes this is done in a separate loglevel_test.go file.

This PR generates this boilerplate file using Terramate, with the additional feature that you can easily re-enable the logging in a specific package by just setting a global.enable_test_logging = true in a specific directory.

Which issue(s) this PR fixes:

none

Special notes for your reviewer:

Does this PR introduce a user-facing change?

no

i4ki avatar Sep 26 '24 00:09 i4ki