summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
Diffstat (limited to 'pkg')
-rw-r--r--pkg/log/log.go4
-rw-r--r--pkg/util/util.go10
2 files changed, 14 insertions, 0 deletions
diff --git a/pkg/log/log.go b/pkg/log/log.go
index 4c69c1c..1e419e3 100644
--- a/pkg/log/log.go
+++ b/pkg/log/log.go
@@ -29,6 +29,10 @@ func SetDebug() {
level = debug
}
+func IsDebug() bool {
+ return level == debug
+}
+
func Debug(v ...interface{}) {
if level <= debug {
_ = debugLogger.Output(2, fmt.Sprint(v...))
diff --git a/pkg/util/util.go b/pkg/util/util.go
index c5472ab..659c886 100644
--- a/pkg/util/util.go
+++ b/pkg/util/util.go
@@ -1,5 +1,7 @@
package util
+import "time"
+
func StrContains(haystack []string, needle string) bool {
for _, s := range haystack {
if s == needle {
@@ -9,3 +11,11 @@ func StrContains(haystack []string, needle string) bool {
return false
}
+
+func TimeFormat(t time.Time) string {
+ if t.IsZero() {
+ return "not set"
+ } else {
+ return t.Format(time.ANSIC)
+ }
+}