Commit 6e58595c authored by Andy Lindeman's avatar Andy Lindeman Committed by GitHub

Log the literal value, not a format string (#5425)

Signed-off-by: default avatarAndy Lindeman <andy@lindeman.io>
parent f8f87e9e
......@@ -46,7 +46,7 @@ func (l Logger) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg)
}
if ok || ok1 {
logstr := l.repl.Replace(ctx, state, rrw, rule.Format)
clog.Infof(logstr)
clog.Info(logstr)
}
return rc, err
......
......@@ -202,6 +202,19 @@ func TestLogged(t *testing.T) {
ShouldLog: true,
ShouldString: "\"0\"",
},
{
Rules: []Rule{
{
NameScope: ".",
Format: CombinedLogFormat,
Class: map[response.Class]struct{}{response.All: {}},
},
},
Domain: "foo.%s.example.org.",
ShouldLog: true,
ShouldString: "foo.%s.example.org.",
ShouldNOTString: "%!s(MISSING)",
},
}
for _, tc := range tests {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment