Skip to content

feat: enhance logging configuration and redaction capabilities - #113

Merged
anhthii merged 2 commits into
mainfrom
feat/redact-sensitive-key
Sep 18, 2026
Merged

anhthii merged 2 commits into
mainfrom
feat/redact-sensitive-key

Conversation

@Azzurriii

@Azzurriii Azzurriii commented Sep 17, 2026 •

Copy link
Copy Markdown
Collaborator
  • Redact sensitive key, url logging
  • Add config for optional logging: Pretty, JSON

Copilot AI lite review requested due to automatic review settings September 17, 2026 04:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Unresolved critical and moderate logging redaction and initialization issues block approval.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Enhances application logging with configurable destinations, formats, and credential/URL redaction.

Changes:

  • Adds stdout, file, and combined logging modes with pretty or JSON output.
  • Normalizes and documents logging configuration.
  • Applies configured logging to command entry points and EVM errors.
  • Adds redaction and configuration tests.
File summaries
File Summary
pkg/common/logger/logger.go Implements logging configuration, output selection, and redaction.
pkg/common/logger/logger_test.go Tests redaction behavior.
pkg/common/config/validate_test.go Tests logging configuration normalization.
pkg/common/config/types.go Defines logging configuration models.
pkg/common/config/load.go Normalizes logging settings during configuration loading.
internal/rpc/evm/client.go Routes batch errors through the common logger.
configs/config.example.yaml Documents logging options.
cmd/indexer/main.go Initializes logging from configuration.
cmd/devtools/blockreliability/main.go Initializes logging from configuration.
Review details
  • Files reviewed: 9/9 changed files
  • Comments generated: 5
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread pkg/common/logger/logger.go Outdated
}

var (
urlInText = regexp.MustCompile(`(?i)(?:https?|redis|rediss|nats)://[^\s"'<>]+`)

var (
urlInText = regexp.MustCompile(`(?i)(?:https?|redis|rediss|nats)://[^\s"'<>]+`)
keyValue = regexp.MustCompile(`(?i)\b(password|passwd|secret|token|api[_-]?key|authorization|credential)\b\s*([=:])\s*[^\s,;"']+`)
Comment on lines +134 to +136
// redactAttr is installed in the slog handler, so it also covers child loggers
// and direct slog calls after Init.
func redactAttr(_ []string, attr slog.Attr) slog.Attr {
Comment on lines 32 to +36
once.Do(func() {
writer := opts.Writer
if writer == nil {
writer = os.Stdout
writer, err := output(opts)
if err != nil {
initErr = err
return
Comment thread pkg/common/logger/logger.go Outdated
key = strings.ToLower(key)
return strings.Contains(key, "password") || strings.Contains(key, "passwd") ||
strings.Contains(key, "secret") || strings.Contains(key, "token") ||
strings.Contains(key, "api_key") || strings.Contains(key, "api-key") ||
@anhthii
anhthii merged commit f111bc2 into main Sep 18, 2026
2 checks passed
@anhthii
anhthii deleted the feat/redact-sensitive-key branch September 18, 2026 00:31
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