Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,6 @@ type Options struct {
Fields []interface{}
// Formatter is the formatter for the logger. The default is TextFormatter.
Formatter Formatter
// Styles is the logger styles for the TextFormatter.
Styles *Styles
}
2 changes: 1 addition & 1 deletion pkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func NewWithOptions(w io.Writer, o Options) *Logger {

l.SetOutput(w)
l.SetLevel(Level(l.level))
l.SetStyles(DefaultStyles())
l.SetStyles(o.Styles)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
l.SetStyles(o.Styles)
styles := o.Styles
if styles == nil {
styles = DefaultStyles()
}
l.SetStyles(styles)


if l.callerFormatter == nil {
l.callerFormatter = ShortCallerFormatter
Expand Down