summaryrefslogtreecommitdiff
path: root/debug/debug.go
diff options
context:
space:
mode:
authorRich Brown <[email protected]>2022-05-05 06:32:23 -0400
committerRich Brown <[email protected]>2022-05-05 06:32:23 -0400
commit79c333fd9811f01eb7277faeeae10fb026ccc84a (patch)
tree3f17058344c5e40d29c81a617b4d99ae28070d6c /debug/debug.go
parent67c44be2794a3d49a372c73b859c8063888f3fac (diff)
parent2a9feb82b55481308c0f6aa9d813e9021b0333ef (diff)
Merge branch 'main' of https://github.com/richb-hanover/goresponsiveness-1
* 'main' of https://github.com/richb-hanover/goresponsiveness-1: Upgraded RPM Calculation Support (Take 1) Make Traceable Interface and Refactor Debugging Fully support self-signed certificates (and add debug levels)
Diffstat (limited to 'debug/debug.go')
-rw-r--r--debug/debug.go35
1 files changed, 35 insertions, 0 deletions
diff --git a/debug/debug.go b/debug/debug.go
new file mode 100644
index 0000000..2a3df4a
--- /dev/null
+++ b/debug/debug.go
@@ -0,0 +1,35 @@
+package debug
+
+type DebugLevel int8
+
+const (
+ NoDebug DebugLevel = iota
+ Debug
+ Warn
+ Error
+)
+
+type DebugWithPrefix struct {
+ Level DebugLevel
+ Prefix string
+}
+
+func NewDebugWithPrefix(level DebugLevel, prefix string) *DebugWithPrefix {
+ return &DebugWithPrefix{Level: level, Prefix: prefix}
+}
+
+func (d *DebugWithPrefix) String() string {
+ return d.Prefix
+}
+
+func IsDebug(level DebugLevel) bool {
+ return level <= Debug
+}
+
+func IsWarn(level DebugLevel) bool {
+ return level <= Warn
+}
+
+func IsError(level DebugLevel) bool {
+ return level <= Error
+}