From 5d4871d5e4252330c84170c24d9fbbfb4b36a80e Mon Sep 17 00:00:00 2001 From: zhangmeng <775834166@qq.com> Date: 星期一, 23 十二月 2019 10:09:53 +0800 Subject: [PATCH] remove viper deps too much --- logo/logo.go | 55 ++++++++++++------------------------------------------- 1 files changed, 12 insertions(+), 43 deletions(-) diff --git a/logo/logo.go b/logo/logo.go index 9209791..e735e3a 100644 --- a/logo/logo.go +++ b/logo/logo.go @@ -1,81 +1,50 @@ package logo import ( - "github.com/amoghe/distillog" - "github.com/natefinch/lumberjack" + "basic.com/valib/logger.git" ) -var loggers []distillog.Logger - func Config(name string, size, backup, age int) { - l := &lumberjack.Logger{ - Filename: name, - MaxSize: size, // megabytes - MaxBackups: backup, - MaxAge: age, // days - } + logger.Config(name, logger.DebugLevel) - logger := distillog.NewStreamLogger("file", l) - loggers = append(loggers, logger) - - distillog.SetOutput(l) } func ShowConsole() { - l := distillog.NewStdoutLogger("console") - loggers = append(loggers, l) + } func Debugf(f string, v ...interface{}) { - for _, l := range loggers { - l.Debugf(f, v...) - } + logger.Debug(f, v) } func Debugln(v ...interface{}) { - for _, l := range loggers { - l.Debugln(v) - } + logger.Debug(v) } func Infof(f string, v ...interface{}) { - for _, l := range loggers { - l.Infof(f, v...) - } + logger.Info(f, v) } func Infoln(v ...interface{}) { - for _, l := range loggers { - l.Infoln(v) - } + logger.Info(v) } func Warningf(f string, v ...interface{}) { - for _, l := range loggers { - l.Warningf(f, v...) - } + logger.Warn(f, v) } func Warningln(v ...interface{}) { - for _, l := range loggers { - l.Warningln(v) - } + logger.Warn(v) } func Errorf(f string, v ...interface{}) { - for _, l := range loggers { - l.Errorf(f, v...) - } + logger.Error(f, v) } func Errorln(v ...interface{}) { - for _, l := range loggers { - l.Errorln(v) - } + logger.Error(v) } func Close() { - for _, l := range loggers { - l.Close() - } + } -- Gitblit v1.8.0