fix: ensure all backends implement Backend
This commit is contained in:
parent
3bb9b9c0a1
commit
6ce7bf634c
2 changed files with 7 additions and 1 deletions
|
@ -22,6 +22,8 @@ type Backend interface {
|
||||||
// Backend to write in file-like objects
|
// Backend to write in file-like objects
|
||||||
//
|
//
|
||||||
|
|
||||||
|
var _ Backend = &FileBackend{}
|
||||||
|
|
||||||
// FileBackend is a backend that writes to a file.
|
// FileBackend is a backend that writes to a file.
|
||||||
type FileBackend struct {
|
type FileBackend struct {
|
||||||
formatter Formatter
|
formatter Formatter
|
||||||
|
@ -130,6 +132,8 @@ func (b *FileBackend) Close() error {
|
||||||
// Noop Backend
|
// Noop Backend
|
||||||
//
|
//
|
||||||
|
|
||||||
|
var _ Backend = &NoopBackend{}
|
||||||
|
|
||||||
// NoopBackend does nothing and discards all log entries without writing them anywhere.
|
// NoopBackend does nothing and discards all log entries without writing them anywhere.
|
||||||
type NoopBackend struct{}
|
type NoopBackend struct{}
|
||||||
|
|
||||||
|
@ -144,7 +148,7 @@ func (*NoopBackend) Write(_ *Record) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetFormatter is a noop.
|
// SetFormatter is a noop.
|
||||||
func (*NoopBackend) SetFormatter(_ *Formatter) {}
|
func (*NoopBackend) SetFormatter(_ Formatter) {}
|
||||||
|
|
||||||
// SetLevel is a noop.
|
// SetLevel is a noop.
|
||||||
func (*NoopBackend) SetLevel(_ Level) {}
|
func (*NoopBackend) SetLevel(_ Level) {}
|
||||||
|
|
|
@ -16,6 +16,8 @@ var errUnknownFacility = errors.New("unknown facility")
|
||||||
// Syslog Backend
|
// Syslog Backend
|
||||||
//
|
//
|
||||||
|
|
||||||
|
var _ Backend = &SyslogBackend{}
|
||||||
|
|
||||||
// SyslogBackend writes the logs to a syslog system.
|
// SyslogBackend writes the logs to a syslog system.
|
||||||
type SyslogBackend struct {
|
type SyslogBackend struct {
|
||||||
w *syslog.Writer
|
w *syslog.Writer
|
||||||
|
|
Loading…
Reference in a new issue