cleanup(netx): another batch of small/simple cleanups (#789)
See https://github.com/ooni/probe/issues/2121
This commit is contained in:
parent
1cb820b19d
commit
ae24ba644c
7 changed files with 42 additions and 149 deletions
|
|
@ -69,3 +69,12 @@ func ErrorToStringOrOK(err error) string {
|
|||
}
|
||||
return "ok"
|
||||
}
|
||||
|
||||
// ValidLoggerOrDefault is a factory that either returns the logger
|
||||
// provided as argument, if not nil, or DiscardLogger.
|
||||
func ValidLoggerOrDefault(logger Logger) Logger {
|
||||
if logger != nil {
|
||||
return logger
|
||||
}
|
||||
return DiscardLogger
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue