News features and improvements (#8)
* added config file implementation, refactoring * add gitignore * improved test * preperations for more metrics * added resource metrics * added first bgp metrics * added asn as label for bgp metrics * added prefix and message counts to bgp metrics * simplified * Update README.md * added yaml dependency * fixed go routine call * added timeout * clean up * added TLS support * set default api port for TLS * added routes metric * added missing log information
This commit is contained in:
committed by
Steve Brunton
parent
c37abb638f
commit
f2866a3a2f
38
vendor/github.com/sirupsen/logrus/entry_test.go
generated
vendored
38
vendor/github.com/sirupsen/logrus/entry_test.go
generated
vendored
@@ -75,3 +75,41 @@ func TestEntryPanicf(t *testing.T) {
|
||||
entry := NewEntry(logger)
|
||||
entry.WithField("err", errBoom).Panicf("kaboom %v", true)
|
||||
}
|
||||
|
||||
const (
|
||||
badMessage = "this is going to panic"
|
||||
panicMessage = "this is broken"
|
||||
)
|
||||
|
||||
type panickyHook struct{}
|
||||
|
||||
func (p *panickyHook) Levels() []Level {
|
||||
return []Level{InfoLevel}
|
||||
}
|
||||
|
||||
func (p *panickyHook) Fire(entry *Entry) error {
|
||||
if entry.Message == badMessage {
|
||||
panic(panicMessage)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func TestEntryHooksPanic(t *testing.T) {
|
||||
logger := New()
|
||||
logger.Out = &bytes.Buffer{}
|
||||
logger.Level = InfoLevel
|
||||
logger.Hooks.Add(&panickyHook{})
|
||||
|
||||
defer func() {
|
||||
p := recover()
|
||||
assert.NotNil(t, p)
|
||||
assert.Equal(t, panicMessage, p)
|
||||
|
||||
entry := NewEntry(logger)
|
||||
entry.Info("another message")
|
||||
}()
|
||||
|
||||
entry := NewEntry(logger)
|
||||
entry.Info(badMessage)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user