2024-04-18 21:55:48 +00:00
|
|
|
package test
|
|
|
|
|
|
|
|
import "github.com/bluenviron/mediamtx/internal/logger"
|
|
|
|
|
|
|
|
type nilLogger struct{}
|
|
|
|
|
|
|
|
func (nilLogger) Log(_ logger.Level, _ string, _ ...interface{}) {
|
|
|
|
}
|
|
|
|
|
|
|
|
// NilLogger is a logger to /dev/null
|
|
|
|
var NilLogger logger.Writer = &nilLogger{}
|
2024-09-15 17:28:05 +00:00
|
|
|
|
2024-10-04 22:49:44 +00:00
|
|
|
type testLogger struct {
|
|
|
|
cb func(level logger.Level, format string, args ...interface{})
|
|
|
|
}
|
|
|
|
|
|
|
|
func (l *testLogger) Log(level logger.Level, format string, args ...interface{}) {
|
|
|
|
l.cb(level, format, args...)
|
|
|
|
}
|
2024-09-15 17:28:05 +00:00
|
|
|
|
2024-10-04 22:49:44 +00:00
|
|
|
// Logger returns a test logger.
|
|
|
|
func Logger(cb func(logger.Level, string, ...interface{})) logger.Writer {
|
|
|
|
return &testLogger{cb: cb}
|
2024-09-15 17:28:05 +00:00
|
|
|
}
|