Skip to content

Commit

Permalink
code review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Exca-DK committed Sep 8, 2023
1 parent 6433db4 commit 1f1273f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions logging/colors/colorize_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions logging/logger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 1f1273f

Please sign in to comment.