基于 `zap` 包封装。除了实现 `Go` 日志包的基本功能外,还实现了很多高级功能 本包基于`github.com/tkestack/tke/pkg/util/log`裁剪
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
325 B

2 years ago
  1. package logrus
  2. import (
  3. "io/ioutil"
  4. "github.com/sirupsen/logrus"
  5. "go.uber.org/zap"
  6. )
  7. // NewLogger create a logrus logger, add hook to it and return it.
  8. func NewLogger(zapLogger *zap.Logger) *logrus.Logger {
  9. logger := logrus.New()
  10. logger.SetOutput(ioutil.Discard)
  11. logger.AddHook(newHook(zapLogger))
  12. return logger
  13. }