change logger interface to not return errors (Refs #50)

See https://github.com/go-kit/kit/issues/164 for discussion of why
kitlog returns an error.

```
Package log is designed to be used for more than simple application info/warning/error logging; it's suitable for log-structured data in an e.g. Lambda architecture, where each invocation is important. I agree with you that if we were doing only application logging the error would be more noise than signal. But the scope of the package is larger than that.
```

Since we are doing only application logging and we're not checking
errors, it is safe to get rid them.
This commit is contained in:
Anton Kaliaev
2017-09-18 18:01:14 -07:00
committed by Ethan Buchman
parent 9a2438e0dc
commit 65a07b80a3
8 changed files with 29 additions and 93 deletions

View File

@ -2,7 +2,6 @@ package log_test
import (
"bytes"
"errors"
"strings"
"testing"
@ -71,23 +70,6 @@ func TestVariousLevels(t *testing.T) {
}
}
func TestErrNotAllowed(t *testing.T) {
myError := errors.New("squelched!")
opts := []log.Option{
log.AllowError(),
log.ErrNotAllowed(myError),
}
logger := log.NewFilter(log.NewNopLogger(), opts...)
if want, have := myError, logger.Info("foo", "bar", "baz"); want != have {
t.Errorf("want %#+v, have %#+v", want, have)
}
if want, have := error(nil), logger.Error("foo", "bar", "baz"); want != have {
t.Errorf("want %#+v, have %#+v", want, have)
}
}
func TestLevelContext(t *testing.T) {
var buf bytes.Buffer