diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-01-26 23:05:48 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-01-26 23:05:48 +0100 |
commit | d669c78c4306290963415568f4a64a1ae2b35b20 (patch) | |
tree | 189a833daf57ffded2e177bfe5a554fd1b886392 /main_windows.go | |
parent | 7139279cd0b08ebbd2c0322bc01d5678aa00cd0e (diff) |
device: combine debug and info log levels into 'verbose'
There are very few cases, if any, in which a user only wants one of
these levels, so combine it into a single level.
While we're at it, reduce indirection on the loggers by using an empty
function rather than a nil function pointer. It's not like we have
retpolines anyway, and we were always calling through a function with a
branch prior, so this seems like a net gain.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'main_windows.go')
-rw-r--r-- | main_windows.go | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/main_windows.go b/main_windows.go index fea1b16..82a333d 100644 --- a/main_windows.go +++ b/main_windows.go @@ -31,11 +31,10 @@ func main() { fmt.Fprintln(os.Stderr, "Warning: this is a test program for Windows, mainly used for debugging this Go package. For a real WireGuard for Windows client, the repo you want is <https://git.zx2c4.com/wireguard-windows/>, which includes this code as a module.") logger := device.NewLogger( - device.LogLevelDebug, + device.LogLevelVerbose, fmt.Sprintf("(%s) ", interfaceName), ) - logger.Infof("Starting wireguard-go version %v", device.WireGuardGoVersion) - logger.Debugf("Debug log enabled") + logger.Verbosef("Starting wireguard-go version %s", device.WireGuardGoVersion) tun, err := tun.CreateTUN(interfaceName, 0) if err == nil { @@ -50,7 +49,7 @@ func main() { device := device.NewDevice(tun, logger) device.Up() - logger.Infof("Device started") + logger.Verbosef("Device started") uapi, err := ipc.UAPIListen(interfaceName) if err != nil { @@ -71,7 +70,7 @@ func main() { go device.IpcHandle(conn) } }() - logger.Infof("UAPI listener started") + logger.Verbosef("UAPI listener started") // wait for program to terminate @@ -90,5 +89,5 @@ func main() { uapi.Close() device.Close() - logger.Infof("Shutting down") + logger.Verbosef("Shutting down") } |