Skip to content

Commit

Permalink
Set proxy protocol logger to DEBUG level
Browse files Browse the repository at this point in the history
  • Loading branch information
mmatur authored and traefiker committed Oct 24, 2019
1 parent c8984e6 commit a6cdd70
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pkg/server/server_entrypoint_tcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,15 @@ func (ln tcpKeepAliveListener) Accept() (net.Conn, error) {
return tc, nil
}

type proxyProtocolLogger struct {
log.Logger
}

// Printf force log level to debug.
func (p proxyProtocolLogger) Printf(format string, v ...interface{}) {
p.Debugf(format, v...)
}

func buildProxyProtocolListener(ctx context.Context, entryPoint *static.EntryPoint, listener net.Listener) (net.Listener, error) {
var sourceCheck func(addr net.Addr) (bool, error)
if entryPoint.ProxyProtocol.Insecure {
Expand All @@ -280,7 +289,7 @@ func buildProxyProtocolListener(ctx context.Context, entryPoint *static.EntryPoi

return proxyprotocol.NewDefaultListener(listener).
WithSourceChecker(sourceCheck).
WithLogger(log.FromContext(ctx)), nil
WithLogger(proxyProtocolLogger{Logger: log.FromContext(ctx)}), nil
}

func buildListener(ctx context.Context, entryPoint *static.EntryPoint) (net.Listener, error) {
Expand Down

0 comments on commit a6cdd70

Please sign in to comment.