Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,8 @@ You can now override the context portForward default address configuration by se
sinceSeconds: 300 # => tail the last 5 mins.
# Toggles log line wrap. Default false
textWrap: false
# Autoscroll in logs will be disabled. Default is false.
disableAutoscroll: false
# Toggles log line timestamp info. Default false
showTime: false
# Provide shell pod customization when nodeShell feature gate is enabled!
Expand Down Expand Up @@ -952,6 +954,7 @@ k9s:
buffer: 5000
sinceSeconds: -1
textWrap: false
disableAutoscroll: false
showTime: false
thresholds:
cpu:
Expand Down
1 change: 1 addition & 0 deletions internal/config/json/schemas/k9s.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
"buffer": {"type": "integer"},
"sinceSeconds": {"type": "integer"},
"textWrap": {"type": "boolean"},
"disableAutoscroll": {"type": "boolean"},
"showTime": {"type": "boolean"}
}
},
Expand Down
1 change: 1 addition & 0 deletions internal/config/json/testdata/k9s/cool.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ k9s:
buffer: 5000
sinceSeconds: -1
textWrap: false
disableAutoscroll: false
showTime: false
thresholds:
cpu:
Expand Down
1 change: 1 addition & 0 deletions internal/config/json/testdata/k9s/toast.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ k9s:
buffer: 5000
sinceSeconds: -1
textWrap: false
disableAutoscroll: false
showTime: false
thresholds:
cpu:
Expand Down
11 changes: 6 additions & 5 deletions internal/config/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ const (

// Logger tracks logger options.
type Logger struct {
TailCount int64 `json:"tail" yaml:"tail"`
BufferSize int `json:"buffer" yaml:"buffer"`
SinceSeconds int64 `json:"sinceSeconds" yaml:"sinceSeconds"`
TextWrap bool `json:"textWrap" yaml:"textWrap"`
ShowTime bool `json:"showTime" yaml:"showTime"`
TailCount int64 `json:"tail" yaml:"tail"`
BufferSize int `json:"buffer" yaml:"buffer"`
SinceSeconds int64 `json:"sinceSeconds" yaml:"sinceSeconds"`
TextWrap bool `json:"textWrap" yaml:"textWrap"`
DisableAutoscroll bool `json:"disableAutoscroll" yaml:"disableAutoscroll"`
ShowTime bool `json:"showTime" yaml:"showTime"`
}

// NewLogger returns a new instance.
Expand Down
1 change: 1 addition & 0 deletions internal/config/testdata/configs/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ k9s:
buffer: 5000
sinceSeconds: -1
textWrap: false
disableAutoscroll: false
showTime: false
thresholds:
cpu:
Expand Down
1 change: 1 addition & 0 deletions internal/config/testdata/configs/expected.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ k9s:
buffer: 800
sinceSeconds: -1
textWrap: false
disableAutoscroll: false
showTime: false
thresholds:
cpu:
Expand Down
1 change: 1 addition & 0 deletions internal/config/testdata/configs/k9s.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ k9s:
buffer: 2000
sinceSeconds: -1
textWrap: false
disableAutoscroll: false
showTime: false
thresholds:
cpu:
Expand Down
1 change: 1 addition & 0 deletions internal/config/testdata/configs/k9s_toast.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ k9s:
buffer: 2000
sinceSeconds: -1
textWrap: false
disableAutoscroll: false
showTime: false
thresholds:
cpu:
Expand Down
4 changes: 4 additions & 0 deletions internal/view/log_indicator.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ func NewLogIndicator(cfg *config.Config, styles *config.Styles, allContainers bo
showTime: cfg.K9s.Logger.ShowTime,
shouldDisplayAllContainers: allContainers,
}

if cfg.K9s.Logger.DisableAutoscroll {
l.scrollStatus = 0
}
l.StylesChanged(styles)
styles.AddListener(&l)
l.SetTextAlign(tview.AlignCenter)
Expand Down