summaryrefslogtreecommitdiff
path: root/vendor/github.com/hashicorp/logutils/README.md
diff options
context:
space:
mode:
authorFlavio Castelli <fcastelli@suse.com>2017-05-03 11:37:08 +0200
committerAlvaro <alvaro.saurin@gmail.com>2017-05-03 11:40:31 +0200
commitee12004ab93e54f326896e9909ba9e6a2bd11e89 (patch)
tree1ea30d204b04425ebd1dadaf8cc991d572c7f0fb /vendor/github.com/hashicorp/logutils/README.md
parenta286dc5494691c2b04c48ef6695ed0c902912c0f (diff)
downloadterraform-provider-libvirt-ee12004ab93e54f326896e9909ba9e6a2bd11e89.tar
terraform-provider-libvirt-ee12004ab93e54f326896e9909ba9e6a2bd11e89.tar.gz
Vendor dependencies with vndr
This fixes issue #123
Diffstat (limited to 'vendor/github.com/hashicorp/logutils/README.md')
-rw-r--r--vendor/github.com/hashicorp/logutils/README.md36
1 files changed, 36 insertions, 0 deletions
diff --git a/vendor/github.com/hashicorp/logutils/README.md b/vendor/github.com/hashicorp/logutils/README.md
new file mode 100644
index 00000000..49490eae
--- /dev/null
+++ b/vendor/github.com/hashicorp/logutils/README.md
@@ -0,0 +1,36 @@
+# logutils
+
+logutils is a Go package that augments the standard library "log" package
+to make logging a bit more modern, without fragmenting the Go ecosystem
+with new logging packages.
+
+## The simplest thing that could possibly work
+
+Presumably your application already uses the default `log` package. To switch, you'll want your code to look like the following:
+
+```go
+package main
+
+import (
+ "log"
+ "os"
+
+ "github.com/hashicorp/logutils"
+)
+
+func main() {
+ filter := &logutils.LevelFilter{
+ Levels: []logutils.LogLevel{"DEBUG", "WARN", "ERROR"},
+ MinLevel: logutils.LogLevel("WARN"),
+ Writer: os.Stderr,
+ }
+ log.SetOutput(filter)
+
+ log.Print("[DEBUG] Debugging") // this will not print
+ log.Print("[WARN] Warning") // this will
+ log.Print("[ERROR] Erring") // and so will this
+ log.Print("Message I haven't updated") // and so will this
+}
+```
+
+This logs to standard error exactly like go's standard logger. Any log messages you haven't converted to have a level will continue to print as before.