Skip to content

learnin/go-multilog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

go-multilog

A simple wrapper for multiple logger instances.

Example

example using https://github.com/sirupsen/logrus

stdOutLogger := logrus.New()
stdOutLogger.Formatter = &logrus.TextFormatter{DisableColors: false}
stdOutLogger.Level = logrus.WarnLevel

logf, _ := os.OpenFile("example.log", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0644)
fileLogger := logrus.New()
fileLogger.Out = logf
fileLogger.Formatter = &logrus.TextFormatter{DisableColors: true}
fileLogger.Level = logrus.DebugLevel

log = multilog.New(stdOutLogger, fileLogger)

log.Debug("debug message")
log.Warn("warn message")

License

MIT

About

A simple wrapper for multiple logger instances

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages