We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
package main import ( "github.com/onrik/logrus/filename" "github.com/onrik/logrus/sentry" log "github.com/sirupsen/logrus" )
var ( dsn = "http://60a0257d7b5a429a8838e5f2ba873ec9:cb785a64cd3649ea987a1f2f5fad5e82@example.com/1" )
func main() { filenameHook := filename.NewHook() filenameHook.Field = "filename" // Customize source field name log.AddHook(filenameHook)
sentryHook := sentry.NewHook(dsn, log.PanicLevel, log.FatalLevel, log.ErrorLevel) log.AddHook(sentryHook) log.WithFields(log.Fields{ "a":"a", }).Info("Request info")
}
that is the log ouput:
time="2017-11-03T00:01:49+08:00" level=info msg="Request info" a=a filename="runtime/proc.go:185"
as you can see ,th filename is error!
The text was updated successfully, but these errors were encountered:
Hmm, it's interesting. I'll check it.
Sorry, something went wrong.
Looks like that default skip param is too high for your case. Try to decrease it.
@onrik why doesn't logrus have a default way to log filename and line? I could only achieve it with your hook.
@RenathoAzevedo, this issue still open 😬
No branches or pull requests
package main
import (
"github.com/onrik/logrus/filename"
"github.com/onrik/logrus/sentry"
log "github.com/sirupsen/logrus"
)
var (
dsn = "http://60a0257d7b5a429a8838e5f2ba873ec9:cb785a64cd3649ea987a1f2f5fad5e82@example.com/1"
)
func main() {
filenameHook := filename.NewHook()
filenameHook.Field = "filename" // Customize source field name
log.AddHook(filenameHook)
}
that is the log ouput:
time="2017-11-03T00:01:49+08:00" level=info msg="Request info" a=a filename="runtime/proc.go:185"
as you can see ,th filename is error!
The text was updated successfully, but these errors were encountered: