@@ -3,11 +3,11 @@ package extproc
33import (
44 "encoding/json"
55 "fmt"
6- "log"
76 "strings"
87
98 "github.com/vllm-project/semantic-router/src/semantic-router/pkg/config"
109 "github.com/vllm-project/semantic-router/src/semantic-router/pkg/metrics"
10+ "github.com/vllm-project/semantic-router/src/semantic-router/pkg/observability"
1111 "github.com/vllm-project/semantic-router/src/semantic-router/pkg/utils/entropy"
1212)
1313
@@ -24,7 +24,7 @@ func (r *OpenAIRouter) getReasoningModeAndCategory(query string) (bool, string)
2424
2525 // If no category was determined (empty string), default to no reasoning
2626 if categoryName == "" {
27- log . Printf ("No category determined for query, defaulting to no reasoning mode" )
27+ observability . Infof ("No category determined for query, defaulting to no reasoning mode" )
2828 return false , ""
2929 }
3030
@@ -38,14 +38,14 @@ func (r *OpenAIRouter) getReasoningModeAndCategory(query string) (bool, string)
3838 if category .UseReasoning {
3939 reasoningStatus = "ENABLED"
4040 }
41- log . Printf ("Reasoning mode decision: Category '%s' → %s" ,
41+ observability . Infof ("Reasoning mode decision: Category '%s' → %s" ,
4242 categoryName , reasoningStatus )
4343 return category .UseReasoning , categoryName
4444 }
4545 }
4646
4747 // If category not found in config, default to no reasoning
48- log . Printf ("Category '%s' not found in configuration, defaulting to no reasoning mode" , categoryName )
48+ observability . Infof ("Category '%s' not found in configuration, defaulting to no reasoning mode" , categoryName )
4949 return false , categoryName
5050}
5151
@@ -55,7 +55,7 @@ func (r *OpenAIRouter) getEntropyBasedReasoningModeAndCategory(query string) (bo
5555 categoryName , confidence , reasoningDecision , err := r .Classifier .ClassifyCategoryWithEntropy (query )
5656
5757 if err != nil {
58- log . Printf ("Entropy-based classification error: %v, falling back to traditional method" , err )
58+ observability . Warnf ("Entropy-based classification error: %v, falling back to traditional method" , err )
5959
6060 // Record fallback metrics
6161 metrics .RecordEntropyFallback ("classification_error" , "traditional_method" )
@@ -74,12 +74,12 @@ func (r *OpenAIRouter) getEntropyBasedReasoningModeAndCategory(query string) (bo
7474 }
7575
7676 // Log the entropy-based decision
77- log . Printf ("Entropy-based reasoning decision: category='%s', confidence=%.3f, use_reasoning=%t, reason=%s, strategy=%s" ,
77+ observability . Infof ("Entropy-based reasoning decision: category='%s', confidence=%.3f, use_reasoning=%t, reason=%s, strategy=%s" ,
7878 categoryName , confidence , reasoningDecision .UseReasoning , reasoningDecision .DecisionReason , reasoningDecision .FallbackStrategy )
7979
8080 // If we have top categories from entropy analysis, log them
8181 if len (reasoningDecision .TopCategories ) > 0 {
82- log . Printf ("Top predicted categories: %v" , reasoningDecision .TopCategories )
82+ observability . Infof ("Top predicted categories: %v" , reasoningDecision .TopCategories )
8383 }
8484
8585 return reasoningDecision .UseReasoning , categoryName , reasoningDecision
@@ -181,11 +181,11 @@ func (r *OpenAIRouter) setReasoningModeToRequestBody(requestBody []byte, enabled
181181
182182 // Log based on what actually happened
183183 if enabled && ! reasoningApplied {
184- log . Printf ("No reasoning support for model: %s (no reasoning family configured)" , model )
184+ observability . Infof ("No reasoning support for model: %s (no reasoning family configured)" , model )
185185 } else if reasoningApplied {
186- log . Printf ("Applied reasoning mode (enabled: %v) with effort (%s) to model: %s" , enabled , appliedEffort , model )
186+ observability . Infof ("Applied reasoning mode (enabled: %v) with effort (%s) to model: %s" , enabled , appliedEffort , model )
187187 } else {
188- log . Printf ("Reasoning mode disabled for model: %s" , model )
188+ observability . Infof ("Reasoning mode disabled for model: %s" , model )
189189 }
190190
191191 // Record metrics for template usage and effort when enabled
@@ -228,7 +228,7 @@ func (r *OpenAIRouter) setReasoningModeToRequestBody(requestBody []byte, enabled
228228// logReasoningConfiguration logs the reasoning mode configuration for all categories during startup
229229func (r * OpenAIRouter ) logReasoningConfiguration () {
230230 if len (r .Config .Categories ) == 0 {
231- log . Printf ("No categories configured for reasoning mode" )
231+ observability . Infof ("No categories configured for reasoning mode" )
232232 return
233233 }
234234
@@ -243,14 +243,14 @@ func (r *OpenAIRouter) logReasoningConfiguration() {
243243 }
244244 }
245245
246- log . Printf ("Reasoning configuration - Total categories: %d" , len (r .Config .Categories ))
246+ observability . Infof ("Reasoning configuration - Total categories: %d" , len (r .Config .Categories ))
247247
248248 if len (reasoningEnabled ) > 0 {
249- log . Printf ("Reasoning ENABLED for categories (%d): %v" , len (reasoningEnabled ), reasoningEnabled )
249+ observability . Infof ("Reasoning ENABLED for categories (%d): %v" , len (reasoningEnabled ), reasoningEnabled )
250250 }
251251
252252 if len (reasoningDisabled ) > 0 {
253- log . Printf ("Reasoning DISABLED for categories (%d): %v" , len (reasoningDisabled ), reasoningDisabled )
253+ observability . Infof ("Reasoning DISABLED for categories (%d): %v" , len (reasoningDisabled ), reasoningDisabled )
254254 }
255255}
256256
@@ -266,7 +266,7 @@ func (r *OpenAIRouter) ClassifyAndDetermineReasoningMode(query string) (string,
266266 if useReasoning {
267267 reasoningStatus = "enabled"
268268 }
269- log . Printf ("Model selection complete: model=%s, reasoning=%s" , bestModel , reasoningStatus )
269+ observability . Infof ("Model selection complete: model=%s, reasoning=%s" , bestModel , reasoningStatus )
270270
271271 return bestModel , useReasoning
272272}
@@ -284,7 +284,7 @@ func (r *OpenAIRouter) LogReasoningConfigurationSummary() {
284284 }
285285 }
286286
287- log . Printf ("Reasoning mode summary: %d/%d categories have reasoning enabled" , enabledCount , len (r .Config .Categories ))
287+ observability . Infof ("Reasoning mode summary: %d/%d categories have reasoning enabled" , enabledCount , len (r .Config .Categories ))
288288}
289289
290290// getReasoningEffort returns the reasoning effort level for a given category
0 commit comments