Logrus-kit inspired by Logrus mate
go get github.com/kamva/logrus-kit
- json
- text
- slack
- stdout
- stderr
- null
Note: To register default logrus-kit formatters,hooks and
outputs , import logrusbase : e.g
import _ "github.com/kamva/logrus-kit/logrusbase"
Example:
package mypackage
import (
"github.com/kamva/logrus-kit"
_ "github.com/kamva/logrus-kit/logrusbase"
"github.com/sirupsen/logrus"
"github.com/spf13/viper"
)
func main() {
v := viper.New()
v.SetDefault("log.level", "info")
v.SetDefault("log.formatter", "text")
v.SetDefault("log.output", "stderr")
v.SetDefault("log.hooks", "")
logger := logrus.New()
err := logruskit.Tune(logger, logruskit.NewViperAdapter(v))
if err != nil {
panic(err)
}
logger.WithFields(logrus.Fields{"test": "is ok"}).Info("salam")
}
- Add more formatter and logger.
- Write tests.
- CI.
- Write example.
- PR to logrus to add this to other logrus tools.