2014-04-14 02:17:20 +04:00
|
|
|
package main
|
|
|
|
|
2016-07-27 15:00:56 +03:00
|
|
|
import (
|
2017-05-12 22:21:58 +03:00
|
|
|
"github.com/sirupsen/logrus"
|
2016-12-02 02:53:16 +03:00
|
|
|
"gopkg.in/gemnasium/logrus-airbrake-hook.v2"
|
2016-07-27 15:00:56 +03:00
|
|
|
)
|
2014-04-14 02:17:20 +04:00
|
|
|
|
|
|
|
var log = logrus.New()
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
log.Formatter = new(logrus.TextFormatter) // default
|
2015-10-06 23:24:51 +03:00
|
|
|
log.Hooks.Add(airbrake.NewHook(123, "xyz", "development"))
|
2014-04-14 02:17:20 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
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!")
|
|
|
|
}
|