Skip to content

Commit

Permalink
Add log.Color()
Browse files Browse the repository at this point in the history
  • Loading branch information
christianezeani committed Oct 28, 2024
1 parent 36f5633 commit 1ef9d3e
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions log/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,21 @@ func New(opts Options) *Logger {
}
}

func Copy(x *Logger, color ...color.Attribute) *Logger {
func Copy(x *Logger, attr ...color.Attribute) *Logger {
result := &Logger{Logger: x.Logger}

if len(color) > 0 {
result.SetColor(color[0])
if len(attr) > 0 {
result.SetColor(attr[0])
}

return result
}

func Color(attr ...color.Attribute) *Logger {
result := Default()

if len(attr) > 0 {
result.SetColor(attr[0])
}

return result
Expand Down

0 comments on commit 1ef9d3e

Please sign in to comment.