mirror of
https://github.com/coredns/coredns.git
synced 2025-11-01 10:43:17 -04:00
Fix all the log replacers
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -62,7 +61,7 @@ func NewReplacer(r *dns.Msg, rr *ResponseRecorder, emptyValue string) Replacer {
|
||||
// TODO(miek): syntax for flags and document it
|
||||
rep.replacements[headerReplacer+"id}"] = strconv.Itoa(int(r.Id))
|
||||
rep.replacements[headerReplacer+"opcode}"] = strconv.Itoa(int(r.Opcode))
|
||||
rep.replacements[headerReplacer+"do}"] = fmt.Sprintf("%b", state.Do())
|
||||
rep.replacements[headerReplacer+"do}"] = boolToString(state.Do())
|
||||
rep.replacements[headerReplacer+"bufsize}"] = strconv.Itoa(state.Size())
|
||||
|
||||
return rep
|
||||
@@ -104,6 +103,13 @@ func (r replacer) Set(key, value string) {
|
||||
r.replacements["{"+key+"}"] = value
|
||||
}
|
||||
|
||||
func boolToString(b bool) string {
|
||||
if b {
|
||||
return "true"
|
||||
}
|
||||
return "false"
|
||||
}
|
||||
|
||||
const (
|
||||
timeFormat = "02/Jan/2006:15:04:05 -0700"
|
||||
headerReplacer = "{>"
|
||||
|
||||
Reference in New Issue
Block a user