github.com/masterhung0112/hk_server/v5@v5.0.0-20220302090640-ec71aef15e1c/shared/mlog/sugar.go (about)

     1  // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
     2  // See LICENSE.txt for license information.
     3  
     4  package mlog
     5  
     6  import (
     7  	"go.uber.org/zap"
     8  )
     9  
    10  // Made for the plugin interface, use the regular logger for other uses
    11  type SugarLogger struct {
    12  	wrappedLogger *Logger
    13  	zapSugar      *zap.SugaredLogger
    14  }
    15  
    16  func (l *SugarLogger) Debug(msg string, keyValuePairs ...interface{}) {
    17  	l.zapSugar.Debugw(msg, keyValuePairs...)
    18  }
    19  
    20  func (l *SugarLogger) Info(msg string, keyValuePairs ...interface{}) {
    21  	l.zapSugar.Infow(msg, keyValuePairs...)
    22  }
    23  
    24  func (l *SugarLogger) Error(msg string, keyValuePairs ...interface{}) {
    25  	l.zapSugar.Errorw(msg, keyValuePairs...)
    26  }
    27  
    28  func (l *SugarLogger) Warn(msg string, keyValuePairs ...interface{}) {
    29  	l.zapSugar.Warnw(msg, keyValuePairs...)
    30  }