@@ -3,6 +3,7 @@ package main
33import (
44 "context"
55 "fmt"
6+ "log/slog"
67 "os"
78 "os/signal"
89 "strings"
@@ -99,6 +100,16 @@ func (s *ServerCLI) buildTagConfig() *wiz.TagConfig {
99100}
100101
101102func (s * ServerCLI ) Run (_ * kong.Context ) error {
103+ // Initialize structured logger
104+ logLevel := slog .LevelInfo
105+ if s .Verbose {
106+ logLevel = slog .LevelDebug
107+ }
108+ logger := slog .New (slog .NewJSONHandler (os .Stdout , & slog.HandlerOptions {
109+ Level : logLevel ,
110+ }))
111+ slog .SetDefault (logger )
112+
102113 fmt .Println ("Starting Version Guard Detector Service (Open Source)" )
103114 fmt .Printf (" Version: %s\n " , version )
104115 fmt .Printf (" Temporal Endpoint: %s\n " , s .TemporalEndpoint )
@@ -184,17 +195,17 @@ func (s *ServerCLI) Run(_ *kong.Context) error {
184195 wizClient := wiz .NewClient (wizHTTPClient , time .Duration (s .WizCacheTTLHours )* time .Hour )
185196
186197 if s .WizAuroraReportID != "" {
187- invSources [types .ResourceTypeAurora ] = wiz .NewAuroraInventorySource (wizClient , s .WizAuroraReportID ).
198+ invSources [types .ResourceTypeAurora ] = wiz .NewAuroraInventorySource (wizClient , s .WizAuroraReportID , logger ).
188199 WithTagConfig (tagConfig )
189200 fmt .Println ("✓ Aurora inventory source configured (Wiz)" )
190201 }
191202 if s .WizElastiCacheReportID != "" {
192- invSources [types .ResourceTypeElastiCache ] = wiz .NewElastiCacheInventorySource (wizClient , s .WizElastiCacheReportID ).
203+ invSources [types .ResourceTypeElastiCache ] = wiz .NewElastiCacheInventorySource (wizClient , s .WizElastiCacheReportID , logger ).
193204 WithTagConfig (tagConfig )
194205 fmt .Println ("✓ ElastiCache inventory source configured (Wiz)" )
195206 }
196207 if s .WizEKSReportID != "" {
197- invSources [types .ResourceTypeEKS ] = wiz .NewEKSInventorySource (wizClient , s .WizEKSReportID ).
208+ invSources [types .ResourceTypeEKS ] = wiz .NewEKSInventorySource (wizClient , s .WizEKSReportID , logger ).
198209 WithTagConfig (tagConfig )
199210 fmt .Println ("✓ EKS inventory source configured (Wiz)" )
200211 }
@@ -240,15 +251,15 @@ func (s *ServerCLI) Run(_ *kong.Context) error {
240251 cacheTTL := 24 * time .Hour
241252
242253 // Aurora EOL provider (using endoflife.date for PostgreSQL versions)
243- eolProviders [types .ResourceTypeAurora ] = eolendoflife .NewProvider (eolHTTPClient , cacheTTL )
254+ eolProviders [types .ResourceTypeAurora ] = eolendoflife .NewProvider (eolHTTPClient , cacheTTL , logger )
244255 fmt .Println ("✓ Aurora EOL provider configured (endoflife.date API)" )
245256
246257 // EKS EOL provider (using endoflife.date for Kubernetes versions)
247- eolProviders [types .ResourceTypeEKS ] = eolendoflife .NewProvider (eolHTTPClient , cacheTTL )
258+ eolProviders [types .ResourceTypeEKS ] = eolendoflife .NewProvider (eolHTTPClient , cacheTTL , logger )
248259 fmt .Println ("✓ EKS EOL provider configured (endoflife.date API)" )
249260
250261 // ElastiCache EOL provider
251- eolProviders [types .ResourceTypeElastiCache ] = eolendoflife .NewProvider (eolHTTPClient , cacheTTL )
262+ eolProviders [types .ResourceTypeElastiCache ] = eolendoflife .NewProvider (eolHTTPClient , cacheTTL , logger )
252263 fmt .Println ("✓ ElastiCache EOL provider configured (endoflife.date API)" )
253264
254265 // Initialize policy engine
@@ -261,6 +272,7 @@ func (s *ServerCLI) Run(_ *kong.Context) error {
261272 invSources [types .ResourceTypeAurora ],
262273 eolProviders [types .ResourceTypeAurora ],
263274 policyEngine ,
275+ logger ,
264276 )
265277 fmt .Println ("✓ Aurora detector initialized" )
266278 }
@@ -271,6 +283,7 @@ func (s *ServerCLI) Run(_ *kong.Context) error {
271283 invSources [types .ResourceTypeEKS ],
272284 eolProviders [types .ResourceTypeEKS ],
273285 policyEngine ,
286+ logger ,
274287 )
275288 fmt .Println ("✓ EKS detector initialized" )
276289 }
0 commit comments