|
| 1 | +# Logger Conversion Summary |
| 2 | + |
| 3 | +## Overview |
| 4 | +This document summarizes the locations where we need to convert from direct log usage or zap.Logger to the internal logger package. |
| 5 | + |
| 6 | +## Files Using Direct log.* Methods (Need Conversion) |
| 7 | +These files are using `log.Debug()`, `log.Error()`, `log.Info()`, `log.Warn()` directly on the logger variable: |
| 8 | + |
| 9 | +### Command Files (cmd/) |
| 10 | +1. `/opt/shells/cmd/root.go` - Uses log.Error() directly |
| 11 | +2. `/opt/shells/cmd/scanner_executor.go` - Multiple log.Error(), log.Debug(), log.Warn() calls |
| 12 | +3. `/opt/shells/cmd/rumble.go` - Direct log usage |
| 13 | +4. `/opt/shells/cmd/schedule.go` - log.Info() calls |
| 14 | +5. `/opt/shells/cmd/fuzz.go` - Direct log usage |
| 15 | +6. `/opt/shells/cmd/deploy.go` - Direct log usage |
| 16 | +7. `/opt/shells/cmd/boileau.go` - Direct log usage |
| 17 | +8. `/opt/shells/cmd/protocol.go` - Direct log usage |
| 18 | +9. `/opt/shells/cmd/scan.go` - Extensive log.Info(), log.Error(), log.Debug(), log.Warn() usage |
| 19 | +10. `/opt/shells/cmd/workflow.go` - Direct log usage |
| 20 | +11. `/opt/shells/cmd/config.go` - log.Info() calls |
| 21 | + |
| 22 | +## Files Using zap.Logger (Need Conversion) |
| 23 | +These files are using `*zap.Logger` directly instead of the internal logger package: |
| 24 | + |
| 25 | +### Package Files (pkg/) |
| 26 | +1. `/opt/shells/pkg/auth/discovery/portscanner.go` |
| 27 | +2. `/opt/shells/pkg/auth/discovery/org_correlation_module.go` |
| 28 | +3. `/opt/shells/pkg/discovery/mail_analyzer.go` |
| 29 | +4. `/opt/shells/pkg/discovery/service_classifier.go` |
| 30 | +5. `/opt/shells/pkg/auth/crawlers.go` |
| 31 | +6. `/opt/shells/pkg/auth/discovery_engine.go` |
| 32 | +7. `/opt/shells/pkg/correlation/clients.go` |
| 33 | +8. `/opt/shells/pkg/correlation/organization.go` |
| 34 | +9. `/opt/shells/pkg/scanners/secrets/trufflehog.go` |
| 35 | +10. `/opt/shells/pkg/correlation/risk_calculator.go` |
| 36 | +11. `/opt/shells/pkg/correlation/timeline_analyzer.go` |
| 37 | +12. `/opt/shells/pkg/correlation/exploit_chainer.go` |
| 38 | +13. `/opt/shells/pkg/ml/techstack.go` |
| 39 | +14. `/opt/shells/pkg/ml/predictor.go` |
| 40 | + |
| 41 | +## Conversion Required |
| 42 | + |
| 43 | +### For Direct log.* Usage |
| 44 | +Replace patterns like: |
| 45 | +- `log.Error("message", "key", value)` → `log.LogError(ctx, err, "operation", "key", value)` |
| 46 | +- `log.Info("message", "key", value)` → `log.Infow("message", "key", value)` |
| 47 | +- `log.Debug("message", "key", value)` → `log.Debugw("message", "key", value)` |
| 48 | +- `log.Warn("message", "key", value)` → `log.Warnw("message", "key", value)` |
| 49 | + |
| 50 | +### For zap.Logger Usage |
| 51 | +Replace: |
| 52 | +- `logger *zap.Logger` → `logger *logger.Logger` |
| 53 | +- Import `"go.uber.org/zap"` → Import `"github.com/CodeMonkeyCybersecurity/shells/internal/logger"` |
| 54 | +- `zap.NewProduction()` → `logger.New(config.LoggerConfig{...})` |
| 55 | +- Direct zap methods → Use internal logger methods with enhanced context |
| 56 | + |
| 57 | +## Enhanced Logging Methods Available |
| 58 | +The internal logger provides enhanced methods for: |
| 59 | +- Context-aware logging: `WithContext(ctx)` |
| 60 | +- Security events: `LogSecurityEvent()`, `LogVulnerability()` |
| 61 | +- Performance tracking: `LogDuration()`, `LogSlowOperation()` |
| 62 | +- HTTP/Network: `LogHTTPRequest()` |
| 63 | +- Database operations: `LogDatabaseOperation()` |
| 64 | +- Scan progress: `LogScanProgress()`, `LogDiscoveryEvent()` |
| 65 | +- Error handling: `LogError()`, `LogPanic()` |
| 66 | +- OpenTelemetry integration: Automatic span correlation |
| 67 | + |
| 68 | +## Priority |
| 69 | +1. Start with cmd/ files as they are entry points |
| 70 | +2. Move to pkg/ files that are core to the scanning functionality |
| 71 | +3. Ensure context is properly propagated for tracing |
0 commit comments