git » log » commit b4d68d6

Add a testable example

author Alberto Bertogli
2017-08-13 18:54:42 UTC
committer Alberto Bertogli
2017-08-13 18:54:42 UTC
parent 691f71f84f7e9f1069ca41e69d504ac7f9b0ff4d

Add a testable example

example_test.go +17 -0

diff --git a/example_test.go b/example_test.go
new file mode 100644
index 0000000..4e870db
--- /dev/null
+++ b/example_test.go
@@ -0,0 +1,17 @@
+package log_test
+
+import "blitiri.com.ar/go/log"
+
+func Example() {
+	log.Init() // only needed once.
+
+	log.Debugf("debugging information: %v %v %v", 1, 2, 3)
+	log.Infof("something normal happened")
+	log.Errorf("something bad happened")
+
+	if log.V(3) { // only entered if -v was >= 3.
+		//expensiveDebugging()
+	}
+
+	// Output:
+}