Skip to content

refactor: introduce slog logging abstraction + zerolog-backed bridge#696

Closed
leninmehedy wants to merge 3 commits into
00499-feat-solo-provisioner-daemon-corefrom
00691-daemon-slog-abstraction
Closed

refactor: introduce slog logging abstraction + zerolog-backed bridge#696
leninmehedy wants to merge 3 commits into
00499-feat-solo-provisioner-daemon-corefrom
00691-daemon-slog-abstraction

Conversation

@leninmehedy

Copy link
Copy Markdown
Member

Description

This pull request refactors logging in the daemon to use Go's standard log/slog API, bridging it to the existing logx backend for unified log output. It also updates error handling in the consensus migration client to use the errorx package for richer error semantics. Additionally, the logx dependency is updated.

Logging refactor and standardization:

  • Replaces direct usage of logx with log/slog in 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))
  • Installs a bridge in cmd/daemon/main.go to direct slog logs to the configured logx sinks, 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:

  • Refactors the consensus migration client (internal/workflows/steps/consensus_migration_client.go) to wrap errors with the errorx package, 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:

  • Updates the github.com/automa-saga/logx dependency from v0.4.0 to v0.5.0 in go.mod to support the new logging bridge and features. ([go.modL9-R9](https://github.com/hashgraph/solo-weaver/pull/696/files#diff-33ef32bf6c23acb95f5902d7097b7a1d5128ca061167ec0716715b0b9eeaa5f6L9-R9))

Related Issues

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>
@leninmehedy leninmehedy requested a review from a team as a code owner June 12, 2026 23:57
@leninmehedy leninmehedy requested a review from boris-bonin June 12, 2026 23:57
@swirlds-automation

swirlds-automation commented Jun 12, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 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>
@leninmehedy

Copy link
Copy Markdown
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.

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.

2 participants