Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - Fix debug logging #4739

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 7 additions & 2 deletions node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func GetCommand() *cobra.Command {
// NOTE(dshulyak) this needs to be max level so that child logger can can be current level or below.
// otherwise it will fail later when child logger will try to increase level.
WithLog(log.RegisterHooks(
log.NewWithLevel("node", zap.NewAtomicLevelAt(zap.InfoLevel)),
log.NewWithLevel("node", zap.NewAtomicLevelAt(zap.DebugLevel)),
events.EventHook()),
),
)
Expand Down Expand Up @@ -294,7 +294,12 @@ func New(opts ...Option) *App {
for _, opt := range opts {
opt(app)
}
log.SetupGlobal(app.log)
// TODO(mafa): this is a hack to suppress debugging logs on 0000.defaultLogger
// to fix this we should get rid of the global logger and pass app.log to all
// components that need it
lvl := zap.NewAtomicLevelAt(zap.InfoLevel)
log.SetupGlobal(app.log.SetLevel(&lvl))

types.SetNetworkHRP(app.Config.NetworkHRP)
return app
}
Expand Down
4 changes: 2 additions & 2 deletions node/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -410,8 +410,8 @@ func TestSpacemeshApp_JsonService(t *testing.T) {

// E2E app test of the stream endpoints in the NodeService.
func TestSpacemeshApp_NodeService(t *testing.T) {
logger := logtest.New(t, zapcore.ErrorLevel)
errlog := log.RegisterHooks(logger, events.EventHook()) // errlog is used to simulate errors in the app
logger := logtest.New(t)
errlog := log.RegisterHooks(logtest.New(t, zap.ErrorLevel), events.EventHook()) // errlog is used to simulate errors in the app

// Use a unique port
port := 1240
Expand Down