diff --git a/logging/colors/colorize_unix.go b/logging/colors/colorize_unix.go index 3f54374e..ba404662 100644 --- a/logging/colors/colorize_unix.go +++ b/logging/colors/colorize_unix.go @@ -7,10 +7,10 @@ import "fmt" var enabled = true -// EnableColor is a simple function for non-windows systems because we know that they support ANSI escape codes +// EnableColor enables the use of colors for non-windows systems. func EnableColor() { enabled = true } -// DisableColor is a simple function for non-windows systems because we know that they support ANSI escape codes +// DisableColor disables the use of colors for non-windows systems. func DisableColor() { enabled = false } // Colorize returns the string s wrapped in ANSI code c for non-windows systems diff --git a/logging/logger_test.go b/logging/logger_test.go index 8a973126..540e78e3 100644 --- a/logging/logger_test.go +++ b/logging/logger_test.go @@ -51,6 +51,8 @@ func TestAddAndRemoveWriter(t *testing.T) { assert.Equal(t, len(logger.structuredWriters), 0) } +// TestDisabledColors verifies the behavior of the unstructured colored logger when colors are disabled, +// ensuring that it does not output colors when the color feature is turned off. func TestDisabledColors(t *testing.T) { // Create a base logger logger := NewLogger(zerolog.InfoLevel)