Description
Right now the Coder VPN tunnel passes a logger set to Info
to the tailnet
client code. This means there's no way for a Coder Desktop user to surface debug logs if they'd like to, as the logs are never sent over the pipe to the network extension (or Windows system service).
Despite being set to Info, our slog library is configured to only flush logs on Error
and above: https://github.com/coder/slog/blob/0ec81e6e67bb1fe88d4d068a6c7325f449008201/slog.go#L111-L152
As the tunnel buffers logs, it's dependent on flushes (calls to Logger.Sync
) for these Info logs to be sent across the pipe. By comparison, Error logs are written across the pipe immediately.
To surface Info
logs and lower we'd need to patch slog
to Sync
after each log (affects all slog dependencies, probably a bad idea) or remove the log buffer on the tunnel, and write all logs to the pipe immediately.
On macOS these logs end up in the system log, streamable from Console.app
, where they can be better filtered. However this does flood the tunnel's pipes with logs, with no way for the user of the application to reduce the traffic on that pipe.
One solution might be to dynamically set the log level based off the contents of the StartRequest
.