Some monitoring refactoring

This commit is contained in:
Miek Gieben
2016-04-06 13:42:56 +01:00
parent be80bf518a
commit 9f5e081a09
3 changed files with 15 additions and 9 deletions

View File

@@ -1,6 +1,7 @@
package middleware
import (
"strconv"
"time"
"github.com/miekg/dns"
@@ -58,8 +59,11 @@ func (r *ResponseRecorder) Size() int {
}
// Rcode returns the rcode.
func (r *ResponseRecorder) Rcode() int {
return r.rcode
func (r *ResponseRecorder) Rcode() string {
if rcode, ok := dns.RcodeToString[r.rcode]; ok {
return rcode
}
return "RCODE" + strconv.Itoa(r.rcode)
}
// Start returns the start time of the ResponseRecorder.