aboutsummaryrefslogtreecommitdiff
path: root/pkg/log/log_test.go
diff options
context:
space:
mode:
authorRasmus Dahlberg <rasmus@mullvad.net>2022-03-27 17:57:55 +0200
committerRasmus Dahlberg <rasmus@mullvad.net>2022-04-19 11:45:12 +0200
commite7cfaf764d5ec6c88b0cb076191ac02412cbde69 (patch)
tree0135a13755482b27762e242193be156277877dd1 /pkg/log/log_test.go
parent4fc0ff2ec2f48519ee245d6d7edee1921cb3b8bc (diff)
add a basic leveled logger
Date and terminal colors are off by default.
Diffstat (limited to 'pkg/log/log_test.go')
-rw-r--r--pkg/log/log_test.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/pkg/log/log_test.go b/pkg/log/log_test.go
new file mode 100644
index 0000000..9f4076d
--- /dev/null
+++ b/pkg/log/log_test.go
@@ -0,0 +1,21 @@
+package log
+
+import (
+ "os"
+)
+
+func Example() {
+ SetOutput(os.Stdout)
+ SetLevel(WarningLevel)
+ SetDate(false)
+ SetColor(false)
+
+ Debug("some debug number: %d\n", 10)
+ Info("some info number: %d\n", 20)
+ Warning("some warning number: %d\n", 30)
+ Error("some error number: %d\n", 40)
+
+ // Output:
+ // [WARN] some warning number: 30
+ // [ERRO] some error number: 40
+}