mirror of
https://github.com/coredns/coredns.git
synced 2025-12-07 10:55:17 -05:00
middleware/log: allows logging based on response classes (#325)
Add the ability to add a class of responses to be logged; success, denial or error. The default is to log everything (all). Fixes #258
This commit is contained in:
4
middleware/cache/cache.go
vendored
4
middleware/cache/cache.go
vendored
@@ -60,7 +60,7 @@ type ResponseWriter struct {
|
||||
// WriteMsg implements the dns.ResponseWriter interface.
|
||||
func (c *ResponseWriter) WriteMsg(res *dns.Msg) error {
|
||||
do := false
|
||||
mt, opt := response.Classify(res)
|
||||
mt, opt := response.Typify(res)
|
||||
if opt != nil {
|
||||
do = opt.Do()
|
||||
}
|
||||
@@ -93,7 +93,7 @@ func (c *ResponseWriter) set(m *dns.Msg, key string, mt response.Type, duration
|
||||
}
|
||||
|
||||
switch mt {
|
||||
case response.Success, response.Delegation:
|
||||
case response.NoError, response.Delegation:
|
||||
i := newItem(m, duration)
|
||||
c.pcache.Add(key, i)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user