mirror of https://github.com/ceph/go-ceph
implements: initialize the internal package with minimal logging support
This log.go file establishes the ability for the package's user to hand it any logger that meets the very minimal interface. Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
parent
f082075f26
commit
80300e4e5a
|
@ -0,0 +1,20 @@
|
||||||
|
package implements
|
||||||
|
|
||||||
|
// DebugLogger is a simple interface to allow debug logging w/in the
|
||||||
|
// implements package.
|
||||||
|
type DebugLogger interface {
|
||||||
|
Printf(format string, v ...interface{})
|
||||||
|
}
|
||||||
|
|
||||||
|
// NoOpLogger is a dummy logger that generates no output.
|
||||||
|
type NoOpLogger struct{}
|
||||||
|
|
||||||
|
// Printf implements the DebugLogger interface.
|
||||||
|
func (NoOpLogger) Printf(_ string, _ ...interface{}) {}
|
||||||
|
|
||||||
|
var logger DebugLogger = NoOpLogger{}
|
||||||
|
|
||||||
|
// SetLogger will set the given debug logger for the whole implements package.
|
||||||
|
func SetLogger(l DebugLogger) {
|
||||||
|
logger = l
|
||||||
|
}
|
Loading…
Reference in New Issue