mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-01 11:29:48 +08:00
0c9a10e8f8
2. adjust logs for query/search requests Signed-off-by: Zach41 <zongmei.zhang@zilliz.com> Signed-off-by: Zach41 <zongmei.zhang@zilliz.com>
32 lines
585 B
Go
32 lines
585 B
Go
package log
|
|
|
|
import "go.uber.org/zap"
|
|
|
|
type MLogger struct {
|
|
*zap.Logger
|
|
}
|
|
|
|
func (l *MLogger) RatedDebug(cost float64, msg string, fields ...zap.Field) bool {
|
|
if R().CheckCredit(cost) {
|
|
l.Debug(msg, fields...)
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
func (l *MLogger) RatedInfo(cost float64, msg string, fields ...zap.Field) bool {
|
|
if R().CheckCredit(cost) {
|
|
l.Info(msg, fields...)
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
func (l *MLogger) RatedWarn(cost float64, msg string, fields ...zap.Field) bool {
|
|
if R().CheckCredit(cost) {
|
|
l.Warn(msg, fields...)
|
|
return true
|
|
}
|
|
return false
|
|
}
|