ooni-probe-cli/internal/engine/model/logger.go
Simone Basso 1eb6e758c6
refactor: move scrubbingLogger to the scrubber pkg (#394)
* refactor: move scrubbingLogger to the scrubber pkg

We need it exported so we can use it in the new implementation.

Part of https://github.com/ooni/probe/issues/1687

* fix test
2021-06-22 14:43:58 +02:00

41 lines
1.0 KiB
Go

package model
// Logger defines the common interface that a logger should have. It is
// out of the box compatible with `log.Log` in `apex/log`.
type Logger interface {
// Debug emits a debug message.
Debug(msg string)
// Debugf formats and emits a debug message.
Debugf(format string, v ...interface{})
// Info emits an informational message.
Info(msg string)
// Infof formats and emits an informational message.
Infof(format string, v ...interface{})
// Warn emits a warning message.
Warn(msg string)
// Warnf formats and emits a warning message.
Warnf(format string, v ...interface{})
}
// DiscardLogger is a logger that discards its input
var DiscardLogger Logger = logDiscarder{}
type logDiscarder struct{}
func (logDiscarder) Debug(msg string) {}
func (logDiscarder) Debugf(format string, v ...interface{}) {}
func (logDiscarder) Info(msg string) {}
func (logDiscarder) Infof(format string, v ...interface{}) {}
func (logDiscarder) Warn(msg string) {}
func (logDiscarder) Warnf(format string, v ...interface{}) {}