Skip to content

Commit 3d2f39d

Browse files
authored
add force color opt (#29)
1 parent 092457b commit 3d2f39d

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

log/log.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,11 @@ func init() {
7777
}
7878

7979
type Options struct {
80-
Context context.Context
81-
LogLevel Level
82-
Sync bool
83-
Location *time.Location
80+
Context context.Context
81+
LogLevel Level
82+
Sync bool
83+
ForceColor bool
84+
Location *time.Location
8485
}
8586

8687
// Initialize the Logger
@@ -90,6 +91,10 @@ func Init(opts *Options) error {
9091
}
9192

9293
formatter := newTimeZoneFormatter(opts.Location)
94+
if opts.ForceColor {
95+
formatter.formatter.ForceColors = true
96+
formatter.formatter.DisableColors = false
97+
}
9398

9499
// Create new logger
95100
logger := logrus.New()

0 commit comments

Comments
 (0)