From 51062863a5c34d81e296cf15c61140911037cf3b Mon Sep 17 00:00:00 2001 From: Wim Date: Mon, 6 Aug 2018 21:47:05 +0200 Subject: Use mod vendor for vendored directory (backwards compatible) --- .../gemnasium/logrus-airbrake-hook.v2/LICENSE | 21 ------- .../gemnasium/logrus-airbrake-hook.v2/airbrake.go | 71 ---------------------- 2 files changed, 92 deletions(-) delete mode 100644 vendor/gopkg.in/gemnasium/logrus-airbrake-hook.v2/LICENSE delete mode 100644 vendor/gopkg.in/gemnasium/logrus-airbrake-hook.v2/airbrake.go (limited to 'vendor/gopkg.in/gemnasium') diff --git a/vendor/gopkg.in/gemnasium/logrus-airbrake-hook.v2/LICENSE b/vendor/gopkg.in/gemnasium/logrus-airbrake-hook.v2/LICENSE deleted file mode 100644 index a4282b2a..00000000 --- a/vendor/gopkg.in/gemnasium/logrus-airbrake-hook.v2/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Gemnasium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/gopkg.in/gemnasium/logrus-airbrake-hook.v2/airbrake.go b/vendor/gopkg.in/gemnasium/logrus-airbrake-hook.v2/airbrake.go deleted file mode 100644 index a92e01ed..00000000 --- a/vendor/gopkg.in/gemnasium/logrus-airbrake-hook.v2/airbrake.go +++ /dev/null @@ -1,71 +0,0 @@ -package airbrake // import "gopkg.in/gemnasium/logrus-airbrake-hook.v2" - -import ( - "errors" - "fmt" - "net/http" - "os" - - "github.com/Sirupsen/logrus" - "gopkg.in/airbrake/gobrake.v2" -) - -// AirbrakeHook to send exceptions to an exception-tracking service compatible -// with the Airbrake API. -type airbrakeHook struct { - Airbrake *gobrake.Notifier -} - -func NewHook(projectID int64, apiKey, env string) *airbrakeHook { - airbrake := gobrake.NewNotifier(projectID, apiKey) - airbrake.AddFilter(func(notice *gobrake.Notice) *gobrake.Notice { - if env == "development" { - return nil - } - notice.Context["environment"] = env - return notice - }) - hook := &airbrakeHook{ - Airbrake: airbrake, - } - return hook -} - -func (hook *airbrakeHook) Fire(entry *logrus.Entry) error { - var notifyErr error - err, ok := entry.Data["error"].(error) - if ok { - notifyErr = err - } else { - notifyErr = errors.New(entry.Message) - } - var req *http.Request - for k, v := range entry.Data { - if r, ok := v.(*http.Request); ok { - req = r - delete(entry.Data, k) - break - } - } - notice := hook.Airbrake.Notice(notifyErr, req, 3) - for k, v := range entry.Data { - notice.Context[k] = fmt.Sprintf("%s", v) - } - - hook.sendNotice(notice) - return nil -} - -func (hook *airbrakeHook) sendNotice(notice *gobrake.Notice) { - if _, err := hook.Airbrake.SendNotice(notice); err != nil { - fmt.Fprintf(os.Stderr, "Failed to send error to Airbrake: %v\n", err) - } -} - -func (hook *airbrakeHook) Levels() []logrus.Level { - return []logrus.Level{ - logrus.ErrorLevel, - logrus.FatalLevel, - logrus.PanicLevel, - } -} -- cgit v1.2.3