aboutsummaryrefslogtreecommitdiffstats
path: root/logger.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-05-14 03:38:06 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-05-14 03:38:06 +0200
commitc1e097d6d0cabb81b3aa180d69107f9857606bf5 (patch)
tree000c3ba19fa2c3a6da7fe848cdaf9e9d313cede8 /logger.go
parentFix dummy additions (diff)
downloadwireguard-go-c1e097d6d0cabb81b3aa180d69107f9857606bf5.tar.xz
wireguard-go-c1e097d6d0cabb81b3aa180d69107f9857606bf5.zip
Optional logging even in background
Diffstat (limited to 'logger.go')
-rw-r--r--logger.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/logger.go b/logger.go
index b8012aa..849f674 100644
--- a/logger.go
+++ b/logger.go
@@ -13,7 +13,8 @@ import (
)
const (
- LogLevelError = iota
+ LogLevelSilent = iota
+ LogLevelError
LogLevelInfo
LogLevelDebug
)
@@ -35,7 +36,10 @@ func NewLogger(level int, prepend string) *Logger {
if level >= LogLevelInfo {
return output, output, ioutil.Discard
}
- return output, ioutil.Discard, ioutil.Discard
+ if level >= LogLevelError {
+ return output, ioutil.Discard, ioutil.Discard
+ }
+ return ioutil.Discard, ioutil.Discard, ioutil.Discard
}()
logger.Debug = log.New(logDebug,