Skip to content

Commit

Permalink
Merge pull request #152 from piyushsingariya/fix/meshkit-logger-2
Browse files Browse the repository at this point in the history
adding output option for logger for golang testing in mesheryctl
  • Loading branch information
leecalcote authored Feb 10, 2022
2 parents 366c5c6 + 5d4c678 commit f719ec2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,11 @@ func New(appname string, opts Options) (Handler, error) {

// log.SetReportCaller(true)
log.SetOutput(os.Stdout)
log.SetLevel(logrus.InfoLevel)
if opts.Output != nil {
log.SetOutput(opts.Output)
}

log.SetLevel(logrus.InfoLevel)
if opts.DebugLevel {
log.SetLevel(logrus.DebugLevel)
}
Expand Down
3 changes: 3 additions & 0 deletions logger/types.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package logger

import "io"

const (
JsonLogFormat = iota
SyslogLogFormat
Expand All @@ -11,4 +13,5 @@ type Format int
type Options struct {
Format Format
DebugLevel bool
Output io.Writer
}

0 comments on commit f719ec2

Please sign in to comment.