From c5fa84b8811784c3d6d9de78360d22809115ccb8 Mon Sep 17 00:00:00 2001 From: Reuben Miller Date: Sat, 18 May 2024 21:33:19 +0200 Subject: [PATCH] feat(views): print file path to the matching view when using --debug --- pkg/dataview/dataview.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/dataview/dataview.go b/pkg/dataview/dataview.go index bbd8e6dce..ef3006b25 100644 --- a/pkg/dataview/dataview.go +++ b/pkg/dataview/dataview.go @@ -22,6 +22,7 @@ var NamespaceSeparator = "::" // Definition contains the view definition of when to use a specific view type Definition struct { FileName string `json:"-"` + Path string `json:"-"` Extension string `json:"-"` Name string `json:"name,omitempty"` Priority int `json:"priority,omitempty"` @@ -138,6 +139,7 @@ func (v *DataView) LoadDefinitions() error { } for i := range viewDefinition.Definitions { viewDefinition.Definitions[i].FileName = d.Name() + viewDefinition.Definitions[i].Path = path viewDefinition.Definitions[i].Extension = extName } definitions = append(definitions, viewDefinition.Definitions...) @@ -311,7 +313,11 @@ func (v *DataView) GetView(r *ViewData) ([]string, error) { } } if matchingDefinition != nil { - v.Logger.Debugf("Found matching view: name=%s", matchingDefinition.Name) + if matchingDefinition.Extension != "" { + v.Logger.Debugf("Found matching view: name=%s, extension=%s, file: %s", matchingDefinition.Name, matchingDefinition.Extension, matchingDefinition.Path) + } else { + v.Logger.Debugf("Found matching view: name=%s, file: %s", matchingDefinition.Name, matchingDefinition.Path) + } v.ActiveView = matchingDefinition return matchingDefinition.Columns, nil }