grafana/pkg/infra/log/composite_logger.go
2023-08-30 18:46:47 +03:00

26 lines
466 B
Go

package log
import gokitlog "github.com/go-kit/log"
type compositeLogger struct {
loggers []gokitlog.Logger
}
func newCompositeLogger(loggers ...gokitlog.Logger) *compositeLogger {
if len(loggers) == 0 {
loggers = []gokitlog.Logger{}
}
return &compositeLogger{loggers: loggers}
}
func (l *compositeLogger) Log(keyvals ...any) error {
for _, logger := range l.loggers {
if err := logger.Log(keyvals...); err != nil {
return err
}
}
return nil
}