diff --git a/pkg/report/report.go b/pkg/report/report.go index ec8784b..31a1d99 100644 --- a/pkg/report/report.go +++ b/pkg/report/report.go @@ -4,7 +4,6 @@ import ( "context" "encoding/json" "fmt" - "os" "time" "github.com/appuio/appuio-reporting/pkg/odoo" @@ -105,18 +104,6 @@ func runQuery(ctx context.Context, odooClient OdooClient, prom PromQuerier, args } } - // print the records to stdout for preview - for _, record := range records { - m, err := json.Marshal(record) - if err != nil { - // can't use the logger from the context here, since the required context key is in the main package 🙃 - // TODO(bastjan) fix the suboptimal and overcomplicated logging setup - fmt.Fprintf(os.Stderr, "warning: failed to marshal record for preview: %+v; error: %s\n", record, err) - continue - } - fmt.Fprintf(os.Stdout, "%s\n", m) - } - return multierr.Append(errs, odooClient.SendData(ctx, records)) } diff --git a/report_command.go b/report_command.go index 2944cf4..6eb116e 100644 --- a/report_command.go +++ b/report_command.go @@ -3,7 +3,6 @@ package main import ( "context" "fmt" - "os" "time" "github.com/appuio/appuio-reporting/pkg/odoo" @@ -122,8 +121,11 @@ func (cmd *reportCommand) runReportRange(ctx context.Context, odooClient *odoo.O started := time.Now() reporter := report.WithProgressReporter(func(p report.Progress) { - fmt.Fprintf(os.Stderr, "Report %d, Current: %s [%s]\n", - p.Count, p.Timestamp.Format(time.RFC3339), time.Since(started).Round(time.Second), + log.Info("Progress report", + "product", cmd.ReportArgs.ProductID, + "reportIndex", p.Count, + "timestamp", p.Timestamp.Format(time.RFC3339), + "timeElapsed", time.Since(started).Round(time.Second), ) })