f17bc5ed73
* inject logger and create logdrop sink * init sink with an empty struct instead of nil * wrap a logger instead of a sink and add a discard logger to avoid double logging * fix compile errors * fix linter errors * Fix bug where log arguments aren't properly formatted * Move log sink construction outside of handler * Add prometheus definition and docs for log drop counter Co-authored-by: Daniel Upton <daniel@floppy.co>
34 lines
859 B
Go
34 lines
859 B
Go
// Code generated by mockery v2.12.2. DO NOT EDIT.
|
|
|
|
package logdrop
|
|
|
|
import (
|
|
hclog "github.com/hashicorp/go-hclog"
|
|
mock "github.com/stretchr/testify/mock"
|
|
|
|
testing "testing"
|
|
)
|
|
|
|
// MockLogger is an autogenerated mock type for the Logger type
|
|
type MockLogger struct {
|
|
mock.Mock
|
|
}
|
|
|
|
// Log provides a mock function with given fields: level, msg, args
|
|
func (_m *MockLogger) Log(level hclog.Level, msg string, args ...interface{}) {
|
|
var _ca []interface{}
|
|
_ca = append(_ca, level, msg)
|
|
_ca = append(_ca, args...)
|
|
_m.Called(_ca...)
|
|
}
|
|
|
|
// NewMockLogger creates a new instance of MockLogger. It also registers the testing.TB interface on the mock and a cleanup function to assert the mocks expectations.
|
|
func NewMockLogger(t testing.TB) *MockLogger {
|
|
mock := &MockLogger{}
|
|
mock.Mock.Test(t)
|
|
|
|
t.Cleanup(func() { mock.AssertExpectations(t) })
|
|
|
|
return mock
|
|
}
|