aboutsummaryrefslogtreecommitdiff
path: root/middleware/pkg/debug/debug.go
diff options
context:
space:
mode:
Diffstat (limited to 'middleware/pkg/debug/debug.go')
-rw-r--r--middleware/pkg/debug/debug.go20
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):]
+}