mirror of
https://github.com/vbatts/go-mtree.git
synced 2024-11-15 13:18:45 +00:00
72ac04e7ca
With: $ git mv vendor/github.com/{S,s}irupsen $ sed -i 's/Sirupsen/sirupsen/g' $(git grep -l Sirupsen) catching up with the upstream lowercasing [1,2,3,4]. Because of the compatibility issues discussed in [3], some consumers may prefer to use the old uppercase version until they have time to update their other Logrus consumers to the new lowercase form. [1]: https://github.com/sirupsen/logrus/blame/v1.0.3/README.md#L6 [2]: https://github.com/sirupsen/logrus/pull/384 [3]: https://github.com/sirupsen/logrus/issues/570#issuecomment-313933276 [4]: https://github.com/sirupsen/logrus/issues/553
35 lines
1,001 B
Go
35 lines
1,001 B
Go
package logrus_test
|
|
|
|
import (
|
|
"github.com/sirupsen/logrus"
|
|
"gopkg.in/gemnasium/logrus-airbrake-hook.v2"
|
|
"os"
|
|
)
|
|
|
|
func Example_hook() {
|
|
var log = logrus.New()
|
|
log.Formatter = new(logrus.TextFormatter) // default
|
|
log.Formatter.(*logrus.TextFormatter).DisableTimestamp = true // remove timestamp from test output
|
|
log.Hooks.Add(airbrake.NewHook(123, "xyz", "development"))
|
|
log.Out = os.Stdout
|
|
|
|
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,
|
|
}).Error("The ice breaks!")
|
|
|
|
// Output:
|
|
// level=info msg="A group of walrus emerges from the ocean" animal=walrus size=10
|
|
// level=warning msg="The group's number increased tremendously!" number=122 omg=true
|
|
// level=error msg="The ice breaks!" number=100 omg=true
|
|
}
|