move stacktraces to debug level, disable debug by default (#329)

* move stacktraces to debug level, disable debug by default

* configure zap better

* var to const
This commit is contained in:
JT Olio 2018-09-09 05:27:09 -06:00 committed by GitHub
parent f62a3c383c
commit fd94300c53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 118 additions and 129 deletions

View File

@ -1,6 +1,3 @@
// Copyright (C) 2018 Storj Labs, Inc.
// See LICENSE for copying information.
// Code generated by MockGen. DO NOT EDIT.
// Source: storj.io/storj/pkg/miniogw/logging (interfaces: ErrorLogger)
@ -8,9 +5,8 @@
package logging
import (
reflect "reflect"
gomock "github.com/golang/mock/gomock"
reflect "reflect"
)
// MockErrorLogger is a mock of ErrorLogger interface
@ -36,9 +32,27 @@ func (m *MockErrorLogger) EXPECT() *MockErrorLoggerMockRecorder {
return m.recorder
}
// Debugf mocks base method
func (m *MockErrorLogger) Debugf(arg0 string, arg1 ...interface{}) {
varargs := []interface{}{arg0}
for _, a := range arg1 {
varargs = append(varargs, a)
}
m.ctrl.Call(m, "Debugf", varargs...)
}
// Debugf indicates an expected call of Debugf
func (mr *MockErrorLoggerMockRecorder) Debugf(arg0 interface{}, arg1 ...interface{}) *gomock.Call {
varargs := append([]interface{}{arg0}, arg1...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Debugf", reflect.TypeOf((*MockErrorLogger)(nil).Debugf), varargs...)
}
// Errorf mocks base method
func (m *MockErrorLogger) Errorf(arg0 string, arg1 ...interface{}) {
varargs := append([]interface{}{arg0}, arg1...)
varargs := []interface{}{arg0}
for _, a := range arg1 {
varargs = append(varargs, a)
}
m.ctrl.Call(m, "Errorf", varargs...)
}

View File

@ -17,7 +17,10 @@ import (
"go.uber.org/zap"
)
var errTemplate = "gateway error: %+v"
const (
errTemplate = "gateway error: %v"
debugTemplate = "gateway error: %+v"
)
type gwLogWrap struct {
gw minio.Gateway
@ -45,6 +48,7 @@ type olLogWrap struct {
// ErrorLogger logs a templated error message.
type ErrorLogger interface {
Errorf(template string, args ...interface{})
Debugf(template string, args ...interface{})
}
// minioError checks if the given error is a minio error.
@ -57,6 +61,7 @@ func minioError(err error) bool {
func (ol *olLogWrap) log(err error) error {
if err != nil && !minioError(err) {
ol.logger.Errorf(errTemplate, err)
ol.logger.Debugf(debugTemplate, err)
}
return err
}

View File

@ -22,6 +22,8 @@ import (
"go.uber.org/zap"
)
//go:generate mockgen -destination logger_mock_test.go -package logging storj.io/storj/pkg/miniogw/logging ErrorLogger
const (
testError = "test error"
bucket = "test-bucket"
@ -115,6 +117,7 @@ func TestShutdown(t *testing.T) {
// Error returned
mol.EXPECT().Shutdown(ctx).Return(ErrTest)
logger.EXPECT().Errorf(errTemplate, ErrTest)
logger.EXPECT().Debugf(debugTemplate, ErrTest)
err = ol.Shutdown(ctx)
assert.Error(t, err, ErrTest.Error())
@ -152,6 +155,7 @@ func TestMakeBucketWithLocation(t *testing.T) {
// Error returned
mol.EXPECT().MakeBucketWithLocation(ctx, bucket, location).Return(ErrTest)
logger.EXPECT().Errorf(errTemplate, ErrTest)
logger.EXPECT().Debugf(debugTemplate, ErrTest)
err = ol.MakeBucketWithLocation(ctx, bucket, location)
assert.Error(t, err, ErrTest.Error())
@ -176,6 +180,7 @@ func TestGetBucketInfo(t *testing.T) {
// Error returned
mol.EXPECT().GetBucketInfo(ctx, bucket).Return(minio.BucketInfo{}, ErrTest)
logger.EXPECT().Errorf(errTemplate, ErrTest)
logger.EXPECT().Debugf(debugTemplate, ErrTest)
info, err = ol.GetBucketInfo(ctx, bucket)
assert.Error(t, err, ErrTest.Error())
assert.Equal(t, minio.BucketInfo{}, info)
@ -202,6 +207,7 @@ func TestListBuckets(t *testing.T) {
// Error returned
mol.EXPECT().ListBuckets(ctx).Return([]minio.BucketInfo{}, ErrTest)
logger.EXPECT().Errorf(errTemplate, ErrTest)
logger.EXPECT().Debugf(debugTemplate, ErrTest)
list, err = ol.ListBuckets(ctx)
assert.Error(t, err, ErrTest.Error())
assert.Equal(t, []minio.BucketInfo{}, list)
@ -227,6 +233,7 @@ func TestDeleteBucket(t *testing.T) {
// Error returned
mol.EXPECT().DeleteBucket(ctx, bucket).Return(ErrTest)
logger.EXPECT().Errorf(errTemplate, ErrTest)
logger.EXPECT().Debugf(debugTemplate, ErrTest)
err = ol.DeleteBucket(ctx, bucket)
assert.Error(t, err, ErrTest.Error())
@ -253,6 +260,7 @@ func TestListObjects(t *testing.T) {
mol.EXPECT().ListObjects(ctx, bucket, prefix, marker, delimiter, maxKeys).
Return(minio.ListObjectsInfo{}, ErrTest)
logger.EXPECT().Errorf(errTemplate, ErrTest)
logger.EXPECT().Debugf(debugTemplate, ErrTest)
list, err = ol.ListObjects(ctx, bucket, prefix, marker, delimiter, maxKeys)
assert.Error(t, err, ErrTest.Error())
assert.Equal(t, minio.ListObjectsInfo{}, list)
@ -287,6 +295,7 @@ func TestListObjectsV2(t *testing.T) {
mol.EXPECT().ListObjectsV2(ctx, bucket, prefix, marker, delimiter, maxKeys,
owner, startAfter).Return(minio.ListObjectsV2Info{}, ErrTest)
logger.EXPECT().Errorf(errTemplate, ErrTest)
logger.EXPECT().Debugf(debugTemplate, ErrTest)
list, err = ol.ListObjectsV2(ctx, bucket, prefix, marker, delimiter,
maxKeys, owner, startAfter)
assert.Error(t, err, ErrTest.Error())
@ -318,6 +327,7 @@ func TestGetObject(t *testing.T) {
// Error returned
mol.EXPECT().GetObject(ctx, bucket, object, offset, length, w, etag).Return(ErrTest)
logger.EXPECT().Errorf(errTemplate, ErrTest)
logger.EXPECT().Debugf(debugTemplate, ErrTest)
err = ol.GetObject(ctx, bucket, object, offset, length, w, etag)
assert.Error(t, err, ErrTest.Error())
@ -342,6 +352,7 @@ func TestGetObjectInfo(t *testing.T) {
// Error returned
mol.EXPECT().GetObjectInfo(ctx, bucket, object).Return(minio.ObjectInfo{}, ErrTest)
logger.EXPECT().Errorf(errTemplate, ErrTest)
logger.EXPECT().Debugf(debugTemplate, ErrTest)
info, err = ol.GetObjectInfo(ctx, bucket, object)
assert.Error(t, err, ErrTest.Error())
assert.Equal(t, minio.ObjectInfo{}, info)
@ -370,6 +381,7 @@ func TestPutObject(t *testing.T) {
// Error returned
mol.EXPECT().PutObject(ctx, bucket, object, data, metadata).Return(minio.ObjectInfo{}, ErrTest)
logger.EXPECT().Errorf(errTemplate, ErrTest)
logger.EXPECT().Debugf(debugTemplate, ErrTest)
info, err = ol.PutObject(ctx, bucket, object, data, metadata)
assert.Error(t, err, ErrTest.Error())
assert.Equal(t, minio.ObjectInfo{}, info)
@ -398,6 +410,7 @@ func TestCopyObject(t *testing.T) {
mol.EXPECT().CopyObject(ctx, bucket, object, destBucket, destObject, objInfo).
Return(minio.ObjectInfo{}, ErrTest)
logger.EXPECT().Errorf(errTemplate, ErrTest)
logger.EXPECT().Debugf(debugTemplate, ErrTest)
info, err = ol.CopyObject(ctx, bucket, object, destBucket, destObject, objInfo)
assert.Error(t, err, ErrTest.Error())
assert.Equal(t, minio.ObjectInfo{}, info)
@ -424,6 +437,7 @@ func TestDeleteObject(t *testing.T) {
// Error returned
mol.EXPECT().DeleteObject(ctx, bucket, object).Return(ErrTest)
logger.EXPECT().Errorf(errTemplate, ErrTest)
logger.EXPECT().Debugf(debugTemplate, ErrTest)
err = ol.DeleteObject(ctx, bucket, object)
assert.Error(t, err, ErrTest.Error())
@ -455,6 +469,7 @@ func TestListMultipartUploads(t *testing.T) {
mol.EXPECT().ListMultipartUploads(ctx, bucket, prefix, marker, uidMarker,
delimiter, maxKeys).Return(minio.ListMultipartsInfo{}, ErrTest)
logger.EXPECT().Errorf(errTemplate, ErrTest)
logger.EXPECT().Debugf(debugTemplate, ErrTest)
list, err = ol.ListMultipartUploads(ctx, bucket, prefix, marker, uidMarker,
delimiter, maxKeys)
assert.Error(t, err, ErrTest.Error())
@ -484,6 +499,7 @@ func TestNewMultipartUpload(t *testing.T) {
// Error returned
mol.EXPECT().NewMultipartUpload(ctx, bucket, object, metadata).Return("", ErrTest)
logger.EXPECT().Errorf(errTemplate, ErrTest)
logger.EXPECT().Debugf(debugTemplate, ErrTest)
id, err = ol.NewMultipartUpload(ctx, bucket, object, metadata)
assert.Error(t, err, ErrTest.Error())
assert.Equal(t, "", id)
@ -513,6 +529,7 @@ func TestCopyObjectPart(t *testing.T) {
mol.EXPECT().CopyObjectPart(ctx, bucket, object, destBucket, destObject,
uploadID, partID, offset, length, objInfo).Return(minio.PartInfo{}, ErrTest)
logger.EXPECT().Errorf(errTemplate, ErrTest)
logger.EXPECT().Debugf(debugTemplate, ErrTest)
info, err = ol.CopyObjectPart(ctx, bucket, object, destBucket, destObject,
uploadID, partID, offset, length, objInfo)
assert.Error(t, err, ErrTest.Error())
@ -546,6 +563,7 @@ func TestPutObjectPart(t *testing.T) {
mol.EXPECT().PutObjectPart(ctx, bucket, object, uploadID, partID, data).
Return(minio.PartInfo{}, ErrTest)
logger.EXPECT().Errorf(errTemplate, ErrTest)
logger.EXPECT().Debugf(debugTemplate, ErrTest)
info, err = ol.PutObjectPart(ctx, bucket, object, uploadID, partID, data)
assert.Error(t, err, ErrTest.Error())
assert.Equal(t, minio.PartInfo{}, info)
@ -575,6 +593,7 @@ func TestListObjectParts(t *testing.T) {
mol.EXPECT().ListObjectParts(ctx, bucket, object, uploadID, partMarker, maxKeys).
Return(minio.ListPartsInfo{}, ErrTest)
logger.EXPECT().Errorf(errTemplate, ErrTest)
logger.EXPECT().Debugf(debugTemplate, ErrTest)
list, err = ol.ListObjectParts(ctx, bucket, object, uploadID, partMarker, maxKeys)
assert.Error(t, err, ErrTest.Error())
assert.Equal(t, minio.ListPartsInfo{}, list)
@ -601,6 +620,7 @@ func TestAbortMultipartUpload(t *testing.T) {
// Error returned
mol.EXPECT().AbortMultipartUpload(ctx, bucket, object, uploadID).Return(ErrTest)
logger.EXPECT().Errorf(errTemplate, ErrTest)
logger.EXPECT().Debugf(debugTemplate, ErrTest)
err = ol.AbortMultipartUpload(ctx, bucket, object, uploadID)
assert.Error(t, err, ErrTest.Error())
@ -629,6 +649,7 @@ func TestCompleteMultipartUpload(t *testing.T) {
mol.EXPECT().CompleteMultipartUpload(ctx, bucket, object, uploadID, parts).
Return(minio.ObjectInfo{}, ErrTest)
logger.EXPECT().Errorf(errTemplate, ErrTest)
logger.EXPECT().Debugf(debugTemplate, ErrTest)
info, err = ol.CompleteMultipartUpload(ctx, bucket, object, uploadID, parts)
assert.Error(t, err, ErrTest.Error())
assert.Equal(t, minio.ObjectInfo{}, info)
@ -655,6 +676,7 @@ func TestReloadFormat(t *testing.T) {
// Error returned
mol.EXPECT().ReloadFormat(ctx, dryRun).Return(ErrTest)
logger.EXPECT().Errorf(errTemplate, ErrTest)
logger.EXPECT().Debugf(debugTemplate, ErrTest)
err = ol.ReloadFormat(ctx, dryRun)
assert.Error(t, err, ErrTest.Error())
@ -679,6 +701,7 @@ func TestHealFormat(t *testing.T) {
// Error returned
mol.EXPECT().HealFormat(ctx, dryRun).Return(madmin.HealResultItem{}, ErrTest)
logger.EXPECT().Errorf(errTemplate, ErrTest)
logger.EXPECT().Debugf(debugTemplate, ErrTest)
item, err = ol.HealFormat(ctx, dryRun)
assert.Error(t, err, ErrTest.Error())
assert.Equal(t, madmin.HealResultItem{}, item)
@ -705,6 +728,7 @@ func TestHealBucket(t *testing.T) {
// Error returned
mol.EXPECT().HealBucket(ctx, bucket, dryRun).Return([]madmin.HealResultItem{}, ErrTest)
logger.EXPECT().Errorf(errTemplate, ErrTest)
logger.EXPECT().Debugf(debugTemplate, ErrTest)
list, err = ol.HealBucket(ctx, bucket, dryRun)
assert.Error(t, err, ErrTest.Error())
assert.Equal(t, []madmin.HealResultItem{}, list)
@ -731,6 +755,7 @@ func TestHealObject(t *testing.T) {
// Error returned
mol.EXPECT().HealObject(ctx, bucket, object, dryRun).Return(madmin.HealResultItem{}, ErrTest)
logger.EXPECT().Errorf(errTemplate, ErrTest)
logger.EXPECT().Debugf(debugTemplate, ErrTest)
item, err = ol.HealObject(ctx, bucket, object, dryRun)
assert.Error(t, err, ErrTest.Error())
assert.Equal(t, madmin.HealResultItem{}, item)
@ -757,6 +782,7 @@ func TestListBucketsHeal(t *testing.T) {
// Error returned
mol.EXPECT().ListBucketsHeal(ctx).Return([]minio.BucketInfo{}, ErrTest)
logger.EXPECT().Errorf(errTemplate, ErrTest)
logger.EXPECT().Debugf(debugTemplate, ErrTest)
list, err = ol.ListBucketsHeal(ctx)
assert.Error(t, err, ErrTest.Error())
assert.Equal(t, []minio.BucketInfo{}, list)
@ -785,6 +811,7 @@ func TestListObjectsHeal(t *testing.T) {
mol.EXPECT().ListObjectsHeal(ctx, bucket, prefix, marker, delimiter, maxKeys).
Return(minio.ListObjectsInfo{}, ErrTest)
logger.EXPECT().Errorf(errTemplate, ErrTest)
logger.EXPECT().Debugf(debugTemplate, ErrTest)
list, err = ol.ListObjectsHeal(ctx, bucket, prefix, marker, delimiter, maxKeys)
assert.Error(t, err, ErrTest.Error())
assert.Equal(t, minio.ListObjectsInfo{}, list)
@ -813,6 +840,7 @@ func TestListLocks(t *testing.T) {
mol.EXPECT().ListLocks(ctx, bucket, prefix, duration).
Return([]minio.VolumeLockInfo{}, ErrTest)
logger.EXPECT().Errorf(errTemplate, ErrTest)
logger.EXPECT().Debugf(debugTemplate, ErrTest)
list, err = ol.ListLocks(ctx, bucket, prefix, duration)
assert.Error(t, err, ErrTest.Error())
assert.Equal(t, []minio.VolumeLockInfo{}, list)
@ -839,6 +867,7 @@ func TestClearLocks(t *testing.T) {
// Error returned
mol.EXPECT().ClearLocks(ctx, lockList).Return(ErrTest)
logger.EXPECT().Errorf(errTemplate, ErrTest)
logger.EXPECT().Debugf(debugTemplate, ErrTest)
err = ol.ClearLocks(ctx, lockList)
assert.Error(t, err, ErrTest.Error())
@ -862,6 +891,7 @@ func TestSetBucketPolicy(t *testing.T) {
// Error returned
mol.EXPECT().SetBucketPolicy(ctx, n, plcy).Return(ErrTest)
logger.EXPECT().Errorf(errTemplate, ErrTest)
logger.EXPECT().Debugf(debugTemplate, ErrTest)
err = ol.SetBucketPolicy(ctx, n, plcy)
assert.Error(t, err, ErrTest.Error())
@ -886,6 +916,7 @@ func TestGetBucketPolicy(t *testing.T) {
// Error returned
mol.EXPECT().GetBucketPolicy(ctx, n).Return(nil, ErrTest)
logger.EXPECT().Errorf(errTemplate, ErrTest)
logger.EXPECT().Debugf(debugTemplate, ErrTest)
p, err = ol.GetBucketPolicy(ctx, n)
assert.Error(t, err, ErrTest.Error())
assert.Nil(t, p)
@ -911,6 +942,7 @@ func TestDeleteBucketPolicy(t *testing.T) {
// Error returned
mol.EXPECT().DeleteBucketPolicy(ctx, n).Return(ErrTest)
logger.EXPECT().Errorf(errTemplate, ErrTest)
logger.EXPECT().Debugf(debugTemplate, ErrTest)
err = ol.DeleteBucketPolicy(ctx, n)
assert.Error(t, err, ErrTest.Error())

View File

@ -14,11 +14,11 @@ import (
"github.com/gogo/protobuf/proto"
"github.com/stretchr/testify/assert"
"github.com/zeebo/errs"
"go.uber.org/zap"
"storj.io/storj/internal/test"
"storj.io/storj/pkg/dht"
"storj.io/storj/pkg/kademlia"
"storj.io/storj/pkg/utils"
"storj.io/storj/protos/overlay"
"storj.io/storj/storage"
"storj.io/storj/storage/boltdb"
@ -240,10 +240,7 @@ func boltTestClient(t *testing.T, data test.KvStore) (_ storage.KeyValueStore, _
boltPath, err := filepath.Abs("test_bolt.db")
assert.NoError(t, err)
logger, err := utils.NewLogger("dev")
assert.NoError(t, err)
client, err := boltdb.NewClient(logger, boltPath, "testBoltdb")
client, err := boltdb.NewClient(zap.L(), boltPath, "testBoltdb")
assert.NoError(t, err)
cleanup := func() {

View File

@ -6,7 +6,7 @@ package process
import (
"context"
"flag"
"log"
"fmt"
"os"
"strings"
"sync"
@ -18,7 +18,6 @@ import (
monkit "gopkg.in/spacemonkeygo/monkit.v2"
"storj.io/storj/pkg/telemetry"
"storj.io/storj/pkg/utils"
)
// ExecuteWithConfig runs a Cobra command with the provided default config
@ -135,7 +134,7 @@ func cleanup(cmd *cobra.Command) {
}
}
logger, err := utils.NewLogger(*logDisposition)
logger, err := newLogger()
if err != nil {
return err
}
@ -143,6 +142,8 @@ func cleanup(cmd *cobra.Command) {
defer zap.ReplaceGlobals(logger)()
defer zap.RedirectStdLog(logger)()
logger.Debug("logging initialized")
// okay now that logging is working, inform about the broken keys
for _, key := range brokenKeys {
logger.Sugar().Infof("Invalid configuration file key: %s", key)
@ -173,7 +174,10 @@ func cleanup(cmd *cobra.Command) {
err = internalRun(cmd, args)
if err != nil {
log.Fatalf("%+v", err)
_, _ = fmt.Fprintf(os.Stderr, "%v\n", err)
logger.Sugar().Debugf("%+v", err)
_ = logger.Sync()
os.Exit(1)
}
return err
}

50
pkg/process/logging.go Normal file
View File

@ -0,0 +1,50 @@
// Copyright (C) 2018 Storj Labs, Inc.
// See LICENSE for copying information.
package process
import (
"flag"
"github.com/zeebo/errs"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
)
var (
// Error is a process error class
Error = errs.Class("process error")
logLevel = zap.LevelFlag("log.level", zapcore.WarnLevel, "the minimum log level to log")
logDev = flag.Bool("log.development", false, "if true, set logging to development mode")
logCaller = flag.Bool("log.caller", false, "if true, log function filename and line number")
logStack = flag.Bool("log.stack", false, "if true, log stack traces")
logEncoding = flag.String("log.encoding", "console", "configures log encoding. can either be 'console' or 'json'")
logOutput = flag.String("log.output", "stderr",
"can be stdout, stderr, or a filename")
)
func newLogger() (*zap.Logger, error) {
return zap.Config{
Level: zap.NewAtomicLevelAt(*logLevel),
Development: *logDev,
DisableCaller: !*logCaller,
DisableStacktrace: !*logStack,
Encoding: *logEncoding,
EncoderConfig: zapcore.EncoderConfig{
TimeKey: "T",
LevelKey: "L",
NameKey: "N",
CallerKey: "C",
MessageKey: "M",
StacktraceKey: "S",
LineEnding: zapcore.DefaultLineEnding,
EncodeLevel: zapcore.CapitalColorLevelEncoder,
EncodeTime: zapcore.ISO8601TimeEncoder,
EncodeDuration: zapcore.StringDurationEncoder,
EncodeCaller: zapcore.ShortCallerEncoder,
},
OutputPaths: []string{*logOutput},
ErrorOutputPaths: []string{*logOutput},
}.Build()
}

View File

@ -1,18 +0,0 @@
// Copyright (C) 2018 Storj Labs, Inc.
// See LICENSE for copying information.
package process
import (
"flag"
"github.com/zeebo/errs"
)
var (
logDisposition = flag.String("log.disp", "dev",
"switch to 'prod' to get less output")
// Error is a process error class
Error = errs.Class("proc error")
)

View File

@ -1,26 +0,0 @@
// Copyright (C) 2018 Storj Labs, Inc.
// See LICENSE for copying information.
package utils
import (
"strings"
"go.uber.org/zap"
)
var zapNewDevelopment = zap.NewDevelopment
var zapNewProduction = zap.NewProduction
var zapNewNop = zap.NewNop
// NewLogger takes an environment and a set of options for a logger
func NewLogger(e string, options ...zap.Option) (*zap.Logger, error) {
switch strings.ToLower(e) {
case "dev", "development":
return zapNewDevelopment(options...)
case "prod", "production":
return zapNewProduction(options...)
}
return zapNewNop(), nil
}

View File

@ -1,69 +0,0 @@
// Copyright (C) 2018 Storj Labs, Inc.
// See LICENSE for copying information.
package utils
import (
"errors"
"testing"
"github.com/stretchr/testify/assert"
"go.uber.org/zap"
)
var errExpected = errors.New("error with initializing logger")
func TestNewLoggerDev(t *testing.T) {
oldZapNewDevelopment := zapNewDevelopment
defer func() { zapNewDevelopment = oldZapNewDevelopment }()
zapNewDevelopment = func(options ...zap.Option) (*zap.Logger, error) {
return nil, errExpected
}
_, err := NewLogger("dev")
assert.NotNil(t, err)
assert.Equal(t, err, errExpected)
_, err = NewLogger("development")
assert.NotNil(t, err)
assert.Equal(t, err, errExpected)
}
func TestNewLoggerProd(t *testing.T) {
oldZapNewProduction := zapNewProduction
defer func() { zapNewProduction = oldZapNewProduction }()
zapNewProduction = func(options ...zap.Option) (*zap.Logger, error) {
return nil, errExpected
}
_, err := NewLogger("prod")
assert.NotNil(t, err)
assert.Equal(t, err, errExpected)
_, err = NewLogger("production")
assert.NotNil(t, err)
assert.Equal(t, err, errExpected)
}
func TestNewLoggerDefault(t *testing.T) {
oldZapNewNop := zapNewNop
defer func() { zapNewNop = oldZapNewNop }()
zapNewNop = func() *zap.Logger {
return nil
}
client, err := NewLogger("default")
assert.Nil(t, client)
assert.Nil(t, err)
}