refactor: introduce slog logging abstraction + zerolog-backed bridge#696
Closed
leninmehedy wants to merge 3 commits into
Closed
refactor: introduce slog logging abstraction + zerolog-backed bridge#696leninmehedy wants to merge 3 commits into
leninmehedy wants to merge 3 commits into
Conversation
Introduce a log/slog seam in the daemon ahead of the pkg/daemonkit extraction (#499). Bump automa-saga/logx to v0.5.0 and install its zerolog-backed slog.Handler via slog.SetDefault in the daemon bootstrap, so slog records reach the same journald + rotating-file sinks logx configures. Convert the 8 daemon-kernel logx call sites (5 in core/monitor.go, 3 in server.go) to slog, preserving the same reason keys, messages, levels, and field names. CLI/workflows stay on logx. Closes #691 Signed-off-by: Lenin Mehedy <lenin.mehedy@hashgraph.com>
Convert the 7 fmt.Errorf sites in consensus_migration_client.go to the errorx standard (forbidigo lint). Network calls use ExternalError, request marshal/build use InternalError, response decode uses IllegalFormat, and remote error statuses use ExternalError. Signed-off-by: Lenin Mehedy <lenin.mehedy@hashgraph.com>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
…ed to support auto download Signed-off-by: Lenin Mehedy <lenin.mehedy@hashgraph.com>
Member
Author
|
Consolidating the daemon slog/daemonkit work into the epic branch 00499 (PR #688) to avoid running the full ~2h CI chain per stacked sub-PR. These commits are being fast-forwarded onto 00499; the single PR #688 -> main remains the CI/review gate. Reopen-as-own-PR only if a specific commit needs isolated review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This pull request refactors logging in the daemon to use Go's standard
log/slogAPI, bridging it to the existinglogxbackend for unified log output. It also updates error handling in the consensus migration client to use theerrorxpackage for richer error semantics. Additionally, thelogxdependency is updated.Logging refactor and standardization:
logxwithlog/slogin daemon core and server code (internal/daemon/core/monitor.go,internal/daemon/server.go), ensuring all logs go through the standard library's logging interface. ([[1]](https://github.com/hashgraph/solo-weaver/pull/696/files#diff-baa68def1963bfb723b4a911774a665131b4a18dd5767de08c1b1a201a2d43d3R8-L11),[[2]](https://github.com/hashgraph/solo-weaver/pull/696/files#diff-baa68def1963bfb723b4a911774a665131b4a18dd5767de08c1b1a201a2d43d3L167-R199),[[3]](https://github.com/hashgraph/solo-weaver/pull/696/files#diff-baa68def1963bfb723b4a911774a665131b4a18dd5767de08c1b1a201a2d43d3L216-R215),[[4]](https://github.com/hashgraph/solo-weaver/pull/696/files#diff-449d4261e84c0d9b67c14859a6c09c3cc4403631e163369749c14a7e0d9945d2R8-L14),[[5]](https://github.com/hashgraph/solo-weaver/pull/696/files#diff-449d4261e84c0d9b67c14859a6c09c3cc4403631e163369749c14a7e0d9945d2L105-R118))cmd/daemon/main.goto directsloglogs to the configuredlogxsinks, maintaining compatibility and centralizing log handling. ([[1]](https://github.com/hashgraph/solo-weaver/pull/696/files#diff-82554fd7bcb5b77d26245b5fc8d10f32b79340ede041fe0f672ae845cff4f08fR8),[[2]](https://github.com/hashgraph/solo-weaver/pull/696/files#diff-82554fd7bcb5b77d26245b5fc8d10f32b79340ede041fe0f672ae845cff4f08fR205-R212))Error handling improvements:
internal/workflows/steps/consensus_migration_client.go) to wrap errors with theerrorxpackage, providing more structured and meaningful error types for internal, external, and format errors. ([[1]](https://github.com/hashgraph/solo-weaver/pull/696/files#diff-7686066d870d27b618000c6d8fcf4f04da061df01c79e626278e5c15941c35e4L8-R12),[[2]](https://github.com/hashgraph/solo-weaver/pull/696/files#diff-7686066d870d27b618000c6d8fcf4f04da061df01c79e626278e5c15941c35e4L21-R21),[[3]](https://github.com/hashgraph/solo-weaver/pull/696/files#diff-7686066d870d27b618000c6d8fcf4f04da061df01c79e626278e5c15941c35e4L30-R30),[[4]](https://github.com/hashgraph/solo-weaver/pull/696/files#diff-7686066d870d27b618000c6d8fcf4f04da061df01c79e626278e5c15941c35e4L40-R40),[[5]](https://github.com/hashgraph/solo-weaver/pull/696/files#diff-7686066d870d27b618000c6d8fcf4f04da061df01c79e626278e5c15941c35e4L57-R62),[[6]](https://github.com/hashgraph/solo-weaver/pull/696/files#diff-7686066d870d27b618000c6d8fcf4f04da061df01c79e626278e5c15941c35e4L96-R98))Dependency updates:
github.com/automa-saga/logxdependency from v0.4.0 to v0.5.0 ingo.modto support the new logging bridge and features. ([go.modL9-R9](https://github.com/hashgraph/solo-weaver/pull/696/files#diff-33ef32bf6c23acb95f5902d7097b7a1d5128ca061167ec0716715b0b9eeaa5f6L9-R9))Related Issues