Skip to content

Commit

Permalink
remove automatic Zap error stacktrace/verbose
Browse files Browse the repository at this point in the history
  • Loading branch information
fredcarle committed Sep 15, 2022
1 parent cbf6045 commit 59ebf79
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions cli/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func (di *defraInstance) close(ctx context.Context) {
log.FeedbackInfo(
ctx,
"The node could not be closed successfully",
logging.NewKV("Error", err),
logging.NewKV("Error", err.Error()),
)
}
}
Expand All @@ -162,7 +162,7 @@ func (di *defraInstance) close(ctx context.Context) {
log.FeedbackInfo(
ctx,
"The server could not be closed successfully",
logging.NewKV("Error", err),
logging.NewKV("Error", err.Error()),
)
}
}
Expand Down
8 changes: 4 additions & 4 deletions logging/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func (l *logger) Error(ctx context.Context, message string, keyvals ...KV) {

func (l *logger) ErrorE(ctx context.Context, message string, err error, keyvals ...KV) {
kvs := keyvals
kvs = append(kvs, NewKV("Error", err))
kvs = append(kvs, NewKV("Error", err.Error()))
kvs = withStackTrace(err, kvs)

l.syncLock.RLock()
Expand All @@ -83,7 +83,7 @@ func (l *logger) Fatal(ctx context.Context, message string, keyvals ...KV) {

func (l *logger) FatalE(ctx context.Context, message string, err error, keyvals ...KV) {
kvs := keyvals
kvs = append(kvs, NewKV("Error", err))
kvs = append(kvs, NewKV("Error", err.Error()))
kvs = withStackTrace(err, kvs)

l.syncLock.RLock()
Expand Down Expand Up @@ -111,7 +111,7 @@ func (l *logger) FeedbackError(ctx context.Context, message string, keyvals ...K
}

func (l *logger) FeedbackErrorE(ctx context.Context, message string, err error, keyvals ...KV) {
l.ErrorE(ctx, message, err, withStackTrace(err, keyvals)...)
l.ErrorE(ctx, message, err, keyvals...)
l.syncLock.RLock()
defer l.syncLock.RUnlock()
if l.consoleLogger != nil {
Expand All @@ -132,7 +132,7 @@ func (l *logger) FeedbackFatal(ctx context.Context, message string, keyvals ...K
}

func (l *logger) FeedbackFatalE(ctx context.Context, message string, err error, keyvals ...KV) {
l.FatalE(ctx, message, err, withStackTrace(err, keyvals)...)
l.FatalE(ctx, message, err, keyvals...)
l.syncLock.RLock()
defer l.syncLock.RUnlock()
if l.consoleLogger != nil {
Expand Down
4 changes: 2 additions & 2 deletions net/peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,12 @@ func (p *Peer) Close() error {
// close event emitters
if p.server.pubSubEmitter != nil {
if err := p.server.pubSubEmitter.Close(); err != nil {
log.Info(p.ctx, "Could not close pubsub event emitter", logging.NewKV("Error", err))
log.Info(p.ctx, "Could not close pubsub event emitter", logging.NewKV("Error", err.Error()))
}
}
if p.server.pushLogEmitter != nil {
if err := p.server.pushLogEmitter.Close(); err != nil {
log.Info(p.ctx, "Could not close push log event emitter", logging.NewKV("Error", err))
log.Info(p.ctx, "Could not close push log event emitter", logging.NewKV("Error", err.Error()))
}
}

Expand Down
8 changes: 4 additions & 4 deletions net/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@ func newServer(p *Peer, db client.DB, opts ...grpc.DialOption) (*server, error)
var err error
s.pubSubEmitter, err = s.peer.host.EventBus().Emitter(new(EvtPubSub))
if err != nil {
log.Info(s.peer.ctx, "could not create event emitter", logging.NewKV("Error", err))
log.Info(s.peer.ctx, "could not create event emitter", logging.NewKV("Error", err.Error()))
}
s.pushLogEmitter, err = s.peer.host.EventBus().Emitter(new(EvtReceivedPushLog))
if err != nil {
log.Info(s.peer.ctx, "could not create event emitter", logging.NewKV("Error", err))
log.Info(s.peer.ctx, "could not create event emitter", logging.NewKV("Error", err.Error()))
}

return s, nil
Expand Down Expand Up @@ -198,7 +198,7 @@ func (s *server) PushLog(ctx context.Context, req *pb.PushLogRequest) (*pb.PushL
if err != nil {
// logging instead of returning an error because the event bus should
// not break the PushLog execution.
log.Info(ctx, "could not emit push log event", logging.NewKV("Error", err))
log.Info(ctx, "could not emit push log event", logging.NewKV("Error", err.Error()))
}
}

Expand Down Expand Up @@ -336,7 +336,7 @@ func (s *server) pubSubEventHandler(from libpeer.ID, topic string, msg []byte) {
Peer: from,
})
if err != nil {
log.Info(s.peer.ctx, "could not emit pubsub event", logging.NewKV("Error", err))
log.Info(s.peer.ctx, "could not emit pubsub event", logging.NewKV("Error", err.Error()))
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/net/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ func executeTestCase(t *testing.T, test P2PTestCase) {
for _, n := range nodes {
n.DB.Close(ctx)
if err := n.Close(); err != nil {
log.Info(ctx, "node not closing as expected", logging.NewKV("Error", err))
log.Info(ctx, "node not closing as expected", logging.NewKV("Error", err.Error()))
}
}
}
Expand Down

0 comments on commit 59ebf79

Please sign in to comment.