Name: trace
Owner: Containous
Description: Package for error handling and error reporting
Forked from: gravitational/trace
Created: 2017-11-21 16:44:40.0
Updated: 2018-04-23 13:02:42.0
Pushed: 2017-11-21 16:52:55.0
Homepage: null
Size: 67
Language: Go
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Package for error handling and error reporting
Read more here:
http://gravitational.com/blog/golang_error_handling/
rt (
"github.com/gravitational/trace"
someFunc() error {
eturn trace.Wrap(err)
main() {
r := someFunc()
t.Println(err.Error()) // prints file, line and function
Add trace's document template to your ElasticSearch cluster
-XPUT 'http://localhost:9200/_template/trace' -d@udbbeat/template.json
Start udpbeat UDP logs collector and emitter
et github.com/gravitational/udpbeat
eat
Hook up logger to UDP collector
In your code, attach a logrus hook to use udpbeat:
rt (
github.com/gravitational/trace"
og "github.com/sirupsen/logrus"
main() {
ook, err := trace.NewUDPHook()
f err != nil {
log.Fatalf(err)
og.SetHook(hook)
Done! You will get structured logs capturing output, log and error message.
You can edit udpbeat/template.json
to modify emitted fields to whatever makes sense to your app.