mirror of
https://github.com/grafana/grafana.git
synced 2024-12-01 21:19:28 -06:00
ec82719372
* 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
49 lines
884 B
Go
49 lines
884 B
Go
package log
|
|
|
|
var _ Logger = (*TestLogger)(nil)
|
|
|
|
type TestLogger struct {
|
|
DebugLogs Logs
|
|
InfoLogs Logs
|
|
WarnLogs Logs
|
|
ErrorLogs Logs
|
|
}
|
|
|
|
func NewTestLogger() *TestLogger {
|
|
return &TestLogger{}
|
|
}
|
|
|
|
func (f *TestLogger) New(_ ...interface{}) Logger {
|
|
return NewTestLogger()
|
|
}
|
|
|
|
func (f *TestLogger) Info(msg string, ctx ...interface{}) {
|
|
f.InfoLogs.Calls++
|
|
f.InfoLogs.Message = msg
|
|
f.InfoLogs.Ctx = ctx
|
|
}
|
|
|
|
func (f *TestLogger) Warn(msg string, ctx ...interface{}) {
|
|
f.WarnLogs.Calls++
|
|
f.WarnLogs.Message = msg
|
|
f.WarnLogs.Ctx = ctx
|
|
}
|
|
|
|
func (f *TestLogger) Debug(msg string, ctx ...interface{}) {
|
|
f.DebugLogs.Calls++
|
|
f.DebugLogs.Message = msg
|
|
f.DebugLogs.Ctx = ctx
|
|
}
|
|
|
|
func (f *TestLogger) Error(msg string, ctx ...interface{}) {
|
|
f.ErrorLogs.Calls++
|
|
f.ErrorLogs.Message = msg
|
|
f.ErrorLogs.Ctx = ctx
|
|
}
|
|
|
|
type Logs struct {
|
|
Calls int
|
|
Message string
|
|
Ctx []interface{}
|
|
}
|