Skip to content

Commit 7998642

Browse files
committed
add logging
1 parent 9be19bd commit 7998642

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

internal/app/main.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package app
22

33
import (
44
"flag"
5-
"fmt"
65
"log"
76
"os"
87
"time"
@@ -78,22 +77,26 @@ func Main() {
7877
startDate = endDate.Add(time.Duration(-config.ExtractDays) * 48 * time.Hour).Add(time.Minute)
7978
}
8079

80+
log.Println("Downloading CSV...")
8181
path, err := DownloadCsv(config, startDate.Format("01/02/2006"), endDate.Format("01/02/2006"))
8282
if err != nil {
8383
log.Fatal(err)
8484
}
85-
fmt.Printf("file downloaded: %s", path)
85+
log.Printf("CSV downloaded: %s\n", path)
8686

8787
records, err := ParseCsv(path)
8888
if err != nil {
8989
log.Fatal(err)
9090
}
91+
log.Println("Querying previous metrics...")
9192
existingPoints, err := QueryPreviousMetrics(startDate, endDate, config.InfluxDB)
9293
if err != nil {
9394
log.Fatal(err)
9495
}
96+
log.Println("Inserting data...")
9597
err = WriteMetrics(records, config.InfluxDB, existingPoints)
9698
if err != nil {
9799
log.Fatal(err)
98100
}
101+
log.Println("Done")
99102
}

0 commit comments

Comments
 (0)