From a1376e44927c19c1c9286b0104fdb31708612d9a Mon Sep 17 00:00:00 2001 From: Jan Hensel Date: Tue, 2 Jul 2024 00:45:05 +0200 Subject: [PATCH] fix: Clean up logging around composite editor slightly --- internal/control/edit/editors/composite_editor.go | 1 - internal/ui/panes/composite_editor_ui_pane.go | 15 +++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/internal/control/edit/editors/composite_editor.go b/internal/control/edit/editors/composite_editor.go index af3e149b..113b2b7e 100644 --- a/internal/control/edit/editors/composite_editor.go +++ b/internal/control/edit/editors/composite_editor.go @@ -42,7 +42,6 @@ func (e *Composite) getCurrentFieldIndex() int { // SwitchToNextField switches to the next field (wrapping araound, if necessary) func (e *Composite) SwitchToNextField() { - log.Trace().Interface("fieldOrder", e.fieldOrder).Msgf("switching to next field") prevID := e.activeFieldID indexOfCurrent := e.getCurrentFieldIndex() nextIndex := (indexOfCurrent + 1) % len(e.fieldOrder) diff --git a/internal/ui/panes/composite_editor_ui_pane.go b/internal/ui/panes/composite_editor_ui_pane.go index c54f94f4..3b7232d0 100644 --- a/internal/ui/panes/composite_editor_ui_pane.go +++ b/internal/ui/panes/composite_editor_ui_pane.go @@ -44,7 +44,7 @@ func (p *CompositeEditorPane) Draw() { for i, id := range fieldOrderSlice { subpane, ok := p.subpanes[id] if !ok { - log.Warn().Msgf("comp: subpane '%s' (%d of %d) not found in subpanes (%v)", id, i, len(fieldOrderSlice), p.subpanes) + p.log.Warn().Msgf("subpane '%s' (%d of %d) not found in subpanes (%v)", id, i, len(fieldOrderSlice), p.subpanes) } else { subpane.Draw() } @@ -95,7 +95,7 @@ func (p *CompositeEditorPane) Undraw() { func (p *CompositeEditorPane) ProcessInput(key input.Key) bool { if p.InputProcessor != nil && p.InputProcessor.CapturesInput() { if p.isInField() { - p.log.Warn().Msgf("comp: somehow, comosite editor is capturing input despite being in field; likely logic error") + p.log.Warn().Msg("somehow, comosite editor is capturing input despite being in field; likely logic error") } return p.InputProcessor.ProcessInput(key) } @@ -104,23 +104,26 @@ func (p *CompositeEditorPane) ProcessInput(key input.Key) bool { editorID := p.getFocussedEditorID() focussedSubpane, ok := p.subpanes[editorID] if !ok { - p.log.Error().Msgf("comp: somehow, have an invalid focussed pane '%s' not in (%v)", editorID, p.subpanes) + p.log.Error().Msgf("somehow, have an invalid focussed pane '%s' not in (%v)", editorID, p.subpanes) return false } processedBySubpane := focussedSubpane.ProcessInput(key) if processedBySubpane { return true } - p.log.Warn().Msgf("comp: input '%s' was not processed by active subeditor pane; will not be processed", key.ToDebugString()) + p.log.Warn(). + Str("key", key.ToDebugString()). + Str("active-subeditor", string(focussedSubpane.Identify())). + Msg("input was not processed by active subeditor pane; will not be processed") return false } if p.InputProcessor == nil { - p.log.Warn().Msg("comp: input processor is nil; will not process input") + p.log.Warn().Msg("input processor is nil; will not process input") return false } - p.log.Trace().Msgf("comp: processing input '%s' self", key.ToDebugString()) + p.log.Trace().Str("key", key.ToDebugString()).Msg("processing input self") return p.InputProcessor.ProcessInput(key) }