Logger接口
// kv form
func Debug(ctx context.Context, kvPairs ...interface{})
func Info(ctx context.Context, kvPairs ...interface{})
func Warning(ctx context.Context, alarmType string, kvPairs ...interface{})
func Error(ctx context.Context, alarmType string, kvPairs ...interface{})
// format form
func Debugf(ctx context.Context, format string, params ...interface{})
func Infof(ctx context.Context, format string, params ...interface{})
func Warningf(ctx context.Context, alarmType string, format string, params ...interface{})
func Errorf(ctx context.Context, alarmType string, format string, params ...interface{})func (p *plugin) func1() {
logger.Debug(p.context.GetRuntimeContext(), "foo", "bar")
logger.Warningf(p.context.GetRuntimeContext(), "TEST_ALARM", "msg %s", "param ignored")
}2021-08-24 18:20:02 [DBG] [logger_test.go:174] [func1] [mock-configname,mock-logstore] foo:bar
2021-08-24 18:20:02 [WARN] [logger_test.go:175] [func1] [mock-configname,mock-logstore] AlarmType:TEST_ALARM msg param ignored打印采集配置元信息
测试中使用Logger
一般用法
高级用法-自定义Logger
高级用法-读取日志内容
启动时控制日志行为
调整日志级别
是否开启控制台打印
Last updated