mirror of
https://github.com/coredns/coredns.git
synced 2025-10-27 16:24:19 -04:00
Log the literal value, not a format string (#5425)
Signed-off-by: Andy Lindeman <andy@lindeman.io>
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user