12345678910111213141516171819202122232425262728293031323334 |
- // Copyright 2019 github.com. All rights reserved.
- // Use of this source code is governed by github.com.
- package tasker
- import "go.uber.org/zap"
- var l *zap.Logger // 日志器
- // Init 注册日志器
- func SetLogger(logger *zap.Logger) {
- l = logger
- }
- // LogError 写error日志
- func LogError(msg string, fields ...zap.Field) {
- if l != nil {
- l.Error(msg, fields...)
- }
- }
- // LogInfo 写info日志
- func LogInfo(msg string, fields ...zap.Field) {
- if l != nil {
- l.Info(msg, fields...)
- }
- }
- // LogDebug 写debug日志
- func LogDebug(msg string, fields ...zap.Field) {
- if l != nil {
- l.Debug(msg, fields...)
- }
- }
|