summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/sirupsen/logrus/examples/hook/hook.go
diff options
context:
space:
mode:
authorLukas Macko <lmacko@cisco.com>2017-09-07 12:45:41 +0200
committerLukas Macko <lmacko@cisco.com>2017-09-07 12:45:41 +0200
commitd07761baec9f09aef0b140ea46e38bd597dbdbbc (patch)
tree406a35de6a2b8d3b5373a917394988b2a8b8f5a7 /vendor/github.com/sirupsen/logrus/examples/hook/hook.go
parentf2cbe790a5c3c3e8cb59b592c252b2b84025bd91 (diff)
import sirupsen with lowercase
Change-Id: I555587fc9ecc074ea1a42f0dc77c11716a1b06cb Signed-off-by: Lukas Macko <lmacko@cisco.com>
Diffstat (limited to 'vendor/github.com/sirupsen/logrus/examples/hook/hook.go')
-rw-r--r--vendor/github.com/sirupsen/logrus/examples/hook/hook.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/vendor/github.com/sirupsen/logrus/examples/hook/hook.go b/vendor/github.com/sirupsen/logrus/examples/hook/hook.go
new file mode 100644
index 0000000..c8470c3
--- /dev/null
+++ b/vendor/github.com/sirupsen/logrus/examples/hook/hook.go
@@ -0,0 +1,30 @@
+package main
+
+import (
+ "github.com/sirupsen/logrus"
+ "gopkg.in/gemnasium/logrus-airbrake-hook.v2"
+)
+
+var log = logrus.New()
+
+func init() {
+ log.Formatter = new(logrus.TextFormatter) // default
+ log.Hooks.Add(airbrake.NewHook(123, "xyz", "development"))
+}
+
+func main() {
+ log.WithFields(logrus.Fields{
+ "animal": "walrus",
+ "size": 10,
+ }).Info("A group of walrus emerges from the ocean")
+
+ log.WithFields(logrus.Fields{
+ "omg": true,
+ "number": 122,
+ }).Warn("The group's number increased tremendously!")
+
+ log.WithFields(logrus.Fields{
+ "omg": true,
+ "number": 100,
+ }).Fatal("The ice breaks!")
+}