feat: structured admin_action log channel#580
Merged
greatest0fallt1me merged 1 commit intoJun 29, 2026
Conversation
4 tasks
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.
closes #561
Description
Implements a dedicated, isolated logging channel for security and administrative event tracking as part of the audit compliance initiative. This PR replaces generic console routing inside administrative routes with a structured, high-context Pino child logger tagged with the channel identity
admin_action.Changes
src/middleware/adminLog.ts): Extracted a dedicated child logger instance from the root Pino configuration containing the permanent context flag{ channel: 'admin_action' }. Built a lifecycle-aware Express hook tracking route metrics (method, fullpath,statusCode,durationMs,ip, anduserAgent).res.locals.adminActorpopulated by the upstreamadminAuthcycle.src/routes/admin.ts): Mounted the interceptor at the root administrative route controller, automatically cascading structural monitoring across all present and future nested modules (/apis,/webhooks,/usage, etc.) with zero individual controller overhead.src/middleware/adminLog.test.ts): Introduced a mock lifecycle environment validating precise execution parameters, response timing traps, and contextual metadata accuracy, ensuring >90% line coverage constraints are explicitly met.README.md): Updated codebase reference guides with operational notices tracking the isolatedadmin_actionstream profile for external aggregation profiles (e.g., Datadog, Logstash).Verification Results