aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.go')
-rw-r--r--src/main.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/main.go b/src/main.go
index dde21fb..196a4c6 100644
--- a/src/main.go
+++ b/src/main.go
@@ -65,9 +65,23 @@ func main() {
return
}
+ // get log level (default: info)
+
+ logLevel := func() int {
+ switch os.Getenv("LOG_LEVEL") {
+ case "debug":
+ return LogLevelDebug
+ case "info":
+ return LogLevelInfo
+ case "error":
+ return LogLevelError
+ }
+ return LogLevelInfo
+ }()
+
// create wireguard device
- device := NewDevice(tun, LogLevelDebug)
+ device := NewDevice(tun, logLevel)
logInfo := device.log.Info
logError := device.log.Error