Skip to content

Commit dba3cce

Browse files
authored
Merge pull request #793 from Tharanishwaran/enhancement/component-logging-details
[Enhancement] Add detailed component logging to registry generate command
2 parents d66bc44 + 20147c9 commit dba3cce

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

registry/spreadsheet_update.go

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,14 +202,30 @@ func updateModelsSheet(srv *sheets.Service, cred, sheetId string, values []*Mode
202202
}
203203

204204
func updateComponentsSheet(srv *sheets.Service, cred, sheetId string, values []*ComponentCSV, csvPath string) error {
205+
if len(values) == 0 {
206+
Log.Info("No components to append, skipping update")
207+
return nil
208+
}
209+
205210
marshalledValues, err := marshalStructToCSValues[ComponentCSV](values)
206-
Log.Info("Appending", len(marshalledValues), "in the components sheet")
207211
if err != nil {
208212
return err
209213
}
210-
err = appendSheet(srv, cred, sheetId, ComponentsSheetAppendRange, marshalledValues, csvPath)
211214

212-
return err
215+
err = appendSheet(srv, cred, sheetId, ComponentsSheetAppendRange, marshalledValues, csvPath)
216+
if err != nil {
217+
return err
218+
}
219+
220+
componentNames := make([]string, 0, len(values))
221+
modelName := values[0].Model
222+
for _, comp := range values {
223+
componentNames = append(componentNames, comp.Component)
224+
}
225+
Log.Infof("Successfully appended %d components for model [%s]: %s",
226+
len(values), modelName, strings.Join(componentNames, ", "))
227+
228+
return nil
213229
}
214230

215231
func appendSheet(srv *sheets.Service, cred, sheetId, appendRange string, values [][]interface{}, csvPaths ...string) error {

0 commit comments

Comments
 (0)