grafana/pkg/plugins/log/logger.go
Will Browne ec82719372
Plugins: Introduce plugin package specific logger (#62204)
* refactor

* implement with infra log for now

* undo moving

* update package name

* update name

* fix tests

* update pretty signature

* update naming

* simplify

* fix typo

* delete comment

* fix import

* retrigger
2023-02-28 16:10:27 +01:00

45 lines
870 B
Go

package log
import (
"github.com/grafana/grafana/pkg/infra/log"
)
func New(name string) Logger {
return &grafanaInfraLogWrapper{
l: log.New(name),
}
}
type grafanaInfraLogWrapper struct {
l *log.ConcreteLogger
}
func (d *grafanaInfraLogWrapper) New(ctx ...interface{}) Logger {
if len(ctx) == 0 {
return &grafanaInfraLogWrapper{
l: d.l.New(),
}
}
ctx = append([]interface{}{"logger"}, ctx...)
return &grafanaInfraLogWrapper{
l: d.l.New(ctx...),
}
}
func (d *grafanaInfraLogWrapper) Debug(msg string, ctx ...interface{}) {
d.l.Debug(msg, ctx...)
}
func (d *grafanaInfraLogWrapper) Info(msg string, ctx ...interface{}) {
d.l.Info(msg, ctx...)
}
func (d *grafanaInfraLogWrapper) Warn(msg string, ctx ...interface{}) {
d.l.Warn(msg, ctx...)
}
func (d *grafanaInfraLogWrapper) Error(msg string, ctx ...interface{}) {
d.l.Error(msg, ctx...)
}