Fetch the repository succeeded.
Use this hook to send your errors to Airbrake.
This hook is using the official airbrake go package, and will hit the api V4.
The hook is synchronous and will send the error for log.Error
, log.Fatal
and log.Panic
levels.
All logrus fields will be sent as context fields on Airbrake.
The hook must be configured with:
import (
"log/syslog"
"github.com/sirupsen/logrus"
"gopkg.in/gemnasium/logrus-airbrake-hook.v4" // the package is named "aibrake"
)
func main() {
log := logrus.New()
log.AddHook(airbrake.NewHook(123, "xyz", "production"))
log.Error("some logging message")
}
Note that if environment == "development", the hook will not send anything to airbrake.
import (
"log/syslog"
"github.com/sirupsen/logrus"
"gopkg.in/gemnasium/logrus-airbrake-hook.v4" // the package is named "aibrake"
)
func main() {
log := logrus.New()
log.AddHook(airbrake.NewHook(123, "xyz", "production"))
req, err := http.NewRequest("GET", "http://example.com", nil)
log.WithField("request", req).Error("some logging message")
}
Notes:
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
1. Open source ecosystem
2. Collaboration, People, Software
3. Evaluation model