update zap/logrus hanler (#1)

Co-authored-by: andrey1s <andrey_simfi@list.ru>
Reviewed-on: #1
Co-authored-by: andrey <andrey@4devs.io>
Co-committed-by: andrey <andrey@4devs.io>
This commit was merged in pull request #1.
This commit is contained in:
2022-01-02 14:32:19 +03:00
parent deb67b0008
commit b56ca08811
22 changed files with 426 additions and 379 deletions

View File

@@ -17,6 +17,8 @@ import (
var requestID ctxKey = "requestID"
func TestFields(t *testing.T) {
t.Parallel()
type rObj struct {
id string
}
@@ -58,6 +60,8 @@ func TestFields(t *testing.T) {
}
func TestWriter(t *testing.T) {
t.Parallel()
ctx := context.Background()
success := "msg=\"info message\" err=file already exists requestID=6a5fa048-7181-11ea-bc55-0242ac1311113 level=info\n"
@@ -84,6 +88,8 @@ func TestWriter(t *testing.T) {
}
func TestLogger(t *testing.T) {
t.Parallel()
ctx := context.Background()
buf := &bytes.Buffer{}
logger := log.New(log.WithWriter(buf)).With(log.WithContextValue(requestID), log.WithLevel("level", level.Info))