fix: Use slog for devtunnel logging (#3248)

Ensures standardized logging for server.
This commit is contained in:
Mathias Fredriksson
2022-07-27 18:05:47 +03:00
committed by GitHub
parent cef622d77c
commit bb05b1f749

View File

@ -79,7 +79,11 @@ func NewWithConfig(ctx context.Context, logger slog.Logger, cfg Config) (*Tunnel
}
wgEndpoint := netip.AddrPortFrom(wgAddr, cfg.Tunnel.WireguardPort)
dev := device.NewDevice(tun, conn.NewDefaultBind(), device.NewLogger(device.LogLevelError, "devtunnel "))
dlog := &device.Logger{
Verbosef: slog.Stdlib(ctx, logger, slog.LevelDebug).Printf,
Errorf: slog.Stdlib(ctx, logger, slog.LevelError).Printf,
}
dev := device.NewDevice(tun, conn.NewDefaultBind(), dlog)
err = dev.IpcSet(fmt.Sprintf(`private_key=%s
public_key=%s
endpoint=%s