diff options
author | 2016-11-29 21:58:13 +0000 | |
---|---|---|
committer | 2016-11-29 21:58:13 +0000 | |
commit | b85c6788dd001189394b9f058823e41507a944a1 (patch) | |
tree | d4479b3e7bd14b7b0087a1d5e7473c7f0a233972 /middleware/pkg/debug/debug.go | |
parent | eb8158ff53cc573d00006e7eacd9469e4208fce4 (diff) | |
parent | 8c8b37a30ea400603c9cb381cc9b71c4da93a536 (diff) | |
download | coredns-b85c6788dd001189394b9f058823e41507a944a1.tar.gz coredns-b85c6788dd001189394b9f058823e41507a944a1.tar.zst coredns-b85c6788dd001189394b9f058823e41507a944a1.zip |
Merge branch 'master' of github.com:miekg/coredns
Diffstat (limited to 'middleware/pkg/debug/debug.go')
-rw-r--r-- | middleware/pkg/debug/debug.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/middleware/pkg/debug/debug.go b/middleware/pkg/debug/debug.go new file mode 100644 index 000000000..b3c33b344 --- /dev/null +++ b/middleware/pkg/debug/debug.go @@ -0,0 +1,20 @@ +package debug + +import "strings" + +const Name = "o-o.debug." + +// IsDebug checks if name is a debugging name, i.e. starts with o-o.debug. +// it returns the empty string if it is not a debug message, otherwise it will return the +// name with o-o.debug. stripped off. Must be called with name lowercased. +func IsDebug(name string) string { + if len(name) == len(Name) { + return "" + } + name = strings.ToLower(name) + debug := strings.HasPrefix(name, Name) + if !debug { + return "" + } + return name[len(Name):] +} |