Objective
Consolidate two similar number formatting functions into a single shared implementation.
Context
Related to #2668 (Duplicate or Near-Duplicate Functions)
Currently there are two implementations with 90% code overlap:
pkg/cli/logs.go:1843-1883 (41 lines) - More sophisticated precision handling
pkg/console/render.go:542-566 (25 lines) - Simpler thresholds
Both format integers as human-readable strings (K/M/B suffixes) but use different precision logic.
Approach
Consolidate into pkg/console/render.go as FormatNumber(n int) string
Use the more sophisticated version from logs.go (better precision thresholds)
Update logs.go to import from the console package
Remove duplicate implementation from logs.go
Ensure consistent number formatting across the entire application
Files to Modify
Primary : pkg/console/render.go
Replace existing formatNumberForDisplay() (lines 542-566) with enhanced version from logs.go
Export as FormatNumber()
Update : pkg/cli/logs.go
Remove formatNumber() function (lines 1843-1883)
Import and use console.FormatNumber()
Update all call sites
Update : Test files for both packages
Acceptance Criteria
Single FormatNumber() function exists in pkg/console/render.go
Function uses the sophisticated precision handling from logs.go
Function correctly formats: 0, <1000, 1K-999K, 1M-999M, 1B+
logs.go imports and uses console.FormatNumber()
All existing tests pass
Unit tests verify formatting for edge cases (0, 999, 1000, 1500, 999999, 1000000, etc.)
25-40 lines of duplicate code removed
Estimated Effort
1 hour
Priority
P1 - High Impact (Quick Win)
Related to #2668
AI generated by Plan Command for #2668
Objective
Consolidate two similar number formatting functions into a single shared implementation.
Context
Related to #2668 (Duplicate or Near-Duplicate Functions)
Currently there are two implementations with 90% code overlap:
pkg/cli/logs.go:1843-1883(41 lines) - More sophisticated precision handlingpkg/console/render.go:542-566(25 lines) - Simpler thresholdsBoth format integers as human-readable strings (K/M/B suffixes) but use different precision logic.
Approach
pkg/console/render.goasFormatNumber(n int) stringlogs.go(better precision thresholds)logs.goto import from the console packagelogs.goFiles to Modify
pkg/console/render.goformatNumberForDisplay()(lines 542-566) with enhanced version from logs.goFormatNumber()pkg/cli/logs.goformatNumber()function (lines 1843-1883)console.FormatNumber()Acceptance Criteria
FormatNumber()function exists inpkg/console/render.gologs.goimports and usesconsole.FormatNumber()Estimated Effort
1 hour
Priority
P1 - High Impact (Quick Win)
Related to #2668