Merge pull request #652 from davidnemec/log-config-customizable-time-and-wrap

Log view: Allow persisting text wrap and timestamp settings
mine
Fernand Galiana 2020-04-10 07:29:19 -06:00 committed by GitHub
commit 26f5477c10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 1 deletions

View File

@ -269,6 +269,8 @@ var expectedConfig = `k9s:
buffer: 800
sinceSeconds: -1
fullScreenLogs: false
textWrap: false
showTime: false
currentContext: blee
currentCluster: blee
clusters:
@ -320,6 +322,8 @@ var resetConfig = `k9s:
buffer: 2000
sinceSeconds: -1
fullScreenLogs: false
textWrap: false
showTime: false
currentContext: blee
currentCluster: blee
clusters:

View File

@ -19,6 +19,8 @@ type Logger struct {
BufferSize int `yaml:"buffer"`
SinceSeconds int64 `yaml:"sinceSeconds"`
FullScreenLogs bool `yaml:"fullScreenLogs"`
TextWrap bool `yaml:"textWrap"`
ShowTime bool `yaml:"showTime"`
}
// NewLogger returns a new instance.

View File

@ -76,7 +76,7 @@ func (l *Log) Init(ctx context.Context) (err error) {
}
l.logs.SetBorderPadding(0, 0, 1, 1)
l.logs.SetText(logMessage)
l.logs.SetWrap(false)
l.logs.SetWrap(l.app.Config.K9s.Logger.TextWrap)
l.logs.SetMaxBuffer(l.app.Config.K9s.Logger.BufferSize)
l.logs.cmdBuff.AddListener(l)

View File

@ -26,6 +26,8 @@ func NewLogIndicator(cfg *config.Config, styles *config.Styles) *LogIndicator {
TextView: tview.NewTextView(),
scrollStatus: 1,
fullScreen: cfg.K9s.Logger.FullScreenLogs,
textWrap: cfg.K9s.Logger.TextWrap,
showTime: cfg.K9s.Logger.ShowTime,
}
l.StylesChanged(styles)
styles.AddListener(&l)