Agent logging#355
Open
jenstopp wants to merge 2 commits into
Open
Conversation
Change the module.Module interface to Init(ctx context.Context) / Deinit(ctx context.Context) and thread an agent-lifetime context through dutagent.Init/Deinit and (*agent).initModules, so a context reaches every module's lifecycle hooks. ipmi now uses the passed context for Connect/Close instead of context.Background(). This is groundwork for structured server logging (logger-in-context) and for future context use. TODO(ctx) markers flag the seams where deadlines and cancellation would attach: client unary RPCs, agent registration, and module startup/shutdown. No behavior change. Signed-off-by: Jens Topp <jens.topp@blindspot.software>
Add internal/log (log/slog based, logger-in-context) and adopt it across the dutagent and dutserver services. Each subsystem sets a flat scope, rendered as a "[scope]" prefix in text output or a "scope" attribute in JSON. A custom text handler formats compact, human-readable lines with TTY-gated color; -log and -log-json flags select level and format. Logs are written to stderr. Modules log from the admin/operator perspective (external interactions and applied defaults) via the context-carried logger, rather than re-narrating client output. dutserver stops dumping whole payloads and demotes per-message forwarding to debug. Signed-off-by: Jens Topp <jens.topp@blindspot.software>
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.
A coherent logging system and policy for the agent and server.
Also touches on #37