Skip to content

Fix/clean loggs#98

Merged
mateeullahmalik merged 4 commits intomasterfrom
fix/clean-loggs
Jul 14, 2025
Merged

Fix/clean loggs#98
mateeullahmalik merged 4 commits intomasterfrom
fix/clean-loggs

Conversation

@mateeullahmalik
Copy link
Collaborator

No description provided.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the logging infrastructure to use zap for structured output, cleans up gRPC logger setup, and makes minor adjustments in various modules to integrate the new logtrace API.

  • Replace slog-based logger with zap in pkg/logtrace, introduce LOG_LEVEL/LOG_TRACING env vars, and remove deprecated functions.
  • Update all SetGRPCLogger calls to the new signature, remove context parameter, and adjust gRPC logger implementation.
  • Add file-overwrite logic in the download task and refactor transaction simulation to simplify gas estimation.

Reviewed Changes

Copilot reviewed 13 out of 15 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/system/go.mod Add direct btcutil and zap dependencies; remove duplicate indirect entry
supernode/node/supernode/server/server.go Update SetGRPCLogger call to new no-arg signature
supernode/cmd/start.go Adjust logtrace.Setup call to match new one-arg signature
sdk/task/download.go Add pre-download file removal logic
pkg/net/grpc/server/server.go Update SetGRPCLogger call to new signature
pkg/net/grpc/client/client.go Update SetGRPCLogger call to new signature
pkg/lumera/modules/tx/impl.go Refactor SimulateTransaction and related methods for simplified gas estimation
pkg/logtrace/log.go Replace slog logger with zap, add env-driven level/tracing controls
pkg/logtrace/grpc_logger.go Change gRPC logger implementation to use zap and no-arg setup
p2p/kademlia/network.go Downgrade certain errors to warnings for handshake/read failures
p2p/kademlia/bootstrap.go Replace fmt.Println with structured logtrace.Debug
go.mod Add go.uber.org/zap dependency
example_env Introduce LOG_LEVEL and LOG_TRACING environment variables
Comments suppressed due to low confidence (5)

sdk/task/download.go:127

  • Consider adding unit or integration tests to cover the new file-removal branch, ensuring behavior when the file exists, doesn’t exist, or removal fails.
	// Remove existing file if it exists to allow overwrite

pkg/logtrace/log.go:92

  • The commented-out correlation ID enrichment means logs no longer include the correlation ID. Restore logic to append extractCorrelationID(ctx) as a zap field so each log entry carries its correlation ID.
	// Always enrich logs with the correlation ID.

supernode/node/supernode/server/server.go:50

  • Dropping the context here means the gRPC logger won’t capture the correlation ID. Either restore a context overload or pass the current context into SetGRPCLogger so internal gRPC logs use the correct correlation ID.
	logtrace.SetGRPCLogger()

pkg/net/grpc/server/server.go:220

  • Calling SetGRPCLogger without context causes loss of correlation IDs in server-side gRPC logs. Consider updating the API to accept or capture the current context.
	logtrace.SetGRPCLogger()

pkg/net/grpc/client/client.go:320

  • The gRPC client’s internal logs no longer include the correlation ID because context isn’t passed. Update SetGRPCLogger (or add a variant) to use the provided context.
	logtrace.SetGRPCLogger()

@mateeullahmalik mateeullahmalik merged commit 29a7a0e into master Jul 14, 2025
7 checks passed
@mateeullahmalik mateeullahmalik deleted the fix/clean-loggs branch July 15, 2025 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants