Feature/DisableAutoscroll (#2865)

* feat: add disableAutoscroll option to logger configuration

* chore: update logger configuration to enable autoscrolling
mine
Ümüt Özalp 2025-02-16 01:36:15 +01:00 committed by GitHub
parent 30291081f4
commit 4acf9384d9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 20 additions and 5 deletions

View File

@ -431,6 +431,8 @@ You can now override the context portForward default address configuration by se
sinceSeconds: 300 # => tail the last 5 mins. sinceSeconds: 300 # => tail the last 5 mins.
# Toggles log line wrap. Default false # Toggles log line wrap. Default false
textWrap: false textWrap: false
# Autoscroll in logs will be disabled. Default is false.
disableAutoscroll: false
# Toggles log line timestamp info. Default false # Toggles log line timestamp info. Default false
showTime: false showTime: false
# Provide shell pod customization when nodeShell feature gate is enabled! # Provide shell pod customization when nodeShell feature gate is enabled!
@ -987,6 +989,7 @@ k9s:
buffer: 5000 buffer: 5000
sinceSeconds: -1 sinceSeconds: -1
textWrap: false textWrap: false
disableAutoscroll: false
showTime: false showTime: false
thresholds: thresholds:
cpu: cpu:

View File

@ -103,6 +103,7 @@
"buffer": {"type": "integer"}, "buffer": {"type": "integer"},
"sinceSeconds": {"type": "integer"}, "sinceSeconds": {"type": "integer"},
"textWrap": {"type": "boolean"}, "textWrap": {"type": "boolean"},
"disableAutoscroll": {"type": "boolean"},
"showTime": {"type": "boolean"} "showTime": {"type": "boolean"}
} }
}, },

View File

@ -29,6 +29,7 @@ k9s:
buffer: 5000 buffer: 5000
sinceSeconds: -1 sinceSeconds: -1
textWrap: false textWrap: false
disableAutoscroll: false
showTime: false showTime: false
thresholds: thresholds:
cpu: cpu:

View File

@ -23,6 +23,7 @@ k9s:
buffer: 5000 buffer: 5000
sinceSeconds: -1 sinceSeconds: -1
textWrap: false textWrap: false
disableAutoscroll: false
showTime: false showTime: false
thresholds: thresholds:
cpu: cpu:

View File

@ -16,11 +16,12 @@ const (
// Logger tracks logger options. // Logger tracks logger options.
type Logger struct { type Logger struct {
TailCount int64 `json:"tail" yaml:"tail"` TailCount int64 `json:"tail" yaml:"tail"`
BufferSize int `json:"buffer" yaml:"buffer"` BufferSize int `json:"buffer" yaml:"buffer"`
SinceSeconds int64 `json:"sinceSeconds" yaml:"sinceSeconds"` SinceSeconds int64 `json:"sinceSeconds" yaml:"sinceSeconds"`
TextWrap bool `json:"textWrap" yaml:"textWrap"` TextWrap bool `json:"textWrap" yaml:"textWrap"`
ShowTime bool `json:"showTime" yaml:"showTime"` DisableAutoscroll bool `json:"disableAutoscroll" yaml:"disableAutoscroll"`
ShowTime bool `json:"showTime" yaml:"showTime"`
} }
// NewLogger returns a new instance. // NewLogger returns a new instance.

View File

@ -31,6 +31,7 @@ k9s:
buffer: 5000 buffer: 5000
sinceSeconds: -1 sinceSeconds: -1
textWrap: false textWrap: false
disableAutoscroll: false
showTime: false showTime: false
thresholds: thresholds:
cpu: cpu:

View File

@ -31,6 +31,7 @@ k9s:
buffer: 800 buffer: 800
sinceSeconds: -1 sinceSeconds: -1
textWrap: false textWrap: false
disableAutoscroll: false
showTime: false showTime: false
thresholds: thresholds:
cpu: cpu:

View File

@ -31,6 +31,7 @@ k9s:
buffer: 2000 buffer: 2000
sinceSeconds: -1 sinceSeconds: -1
textWrap: false textWrap: false
disableAutoscroll: false
showTime: false showTime: false
thresholds: thresholds:
cpu: cpu:

View File

@ -29,6 +29,7 @@ k9s:
buffer: 2000 buffer: 2000
sinceSeconds: -1 sinceSeconds: -1
textWrap: false textWrap: false
disableAutoscroll: false
showTime: false showTime: false
thresholds: thresholds:
cpu: cpu:

View File

@ -39,6 +39,10 @@ func NewLogIndicator(cfg *config.Config, styles *config.Styles, allContainers bo
showTime: cfg.K9s.Logger.ShowTime, showTime: cfg.K9s.Logger.ShowTime,
shouldDisplayAllContainers: allContainers, shouldDisplayAllContainers: allContainers,
} }
if cfg.K9s.Logger.DisableAutoscroll {
l.scrollStatus = 0
}
l.StylesChanged(styles) l.StylesChanged(styles)
styles.AddListener(&l) styles.AddListener(&l)
l.SetTextAlign(tview.AlignCenter) l.SetTextAlign(tview.AlignCenter)