Skip to content

Commit 37bfc82

Browse files
committed
use fmt instead of log, systemd has timestamps
1 parent 1bc8625 commit 37bfc82

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

internal/app/main.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"errors"
55
"flag"
66
"fmt"
7-
"log"
87
"os"
98
"time"
109

@@ -86,16 +85,16 @@ func Main() error {
8685
// subtract N days and 1 minute to get the start date
8786
startDate = endDate.Add(time.Duration(-config.ExtractDays) * 24 * time.Hour).Add(time.Minute)
8887
}
89-
log.Printf("Start date: %s\n", startDate)
90-
log.Printf("End date: %s\n", endDate)
88+
fmt.Printf("Start date: %s\n", startDate)
89+
fmt.Printf("End date: %s\n", endDate)
9190

92-
log.Println("Authenticating with Novec API...")
91+
fmt.Println("Authenticating with Novec API...")
9392
jwt, err := Auth(config.Utility)
9493
if err != nil {
9594
return err
9695
}
9796

98-
log.Println("Fetching data from Novec API...")
97+
fmt.Println("Fetching data from Novec API...")
9998
usage, err := retry.DoWithData(
10099
func() ([]ElectricUsage, error) {
101100
r, err := FetchData(startDate, endDate, config.Utility, jwt)
@@ -120,6 +119,6 @@ func Main() error {
120119
if err != nil {
121120
return err
122121
}
123-
log.Println("Done")
122+
fmt.Println("Done")
124123
return nil
125124
}

internal/app/parser.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"errors"
66
"fmt"
77
"io"
8-
"log"
98
"time"
109
)
1110

@@ -77,7 +76,7 @@ func ParseReader(reader io.ReadCloser) ([]ElectricUsage, error) {
7776
return nil, err
7877
}
7978
if resp.Status != "COMPLETE" {
80-
log.Println("Data not ready, retrying...")
79+
fmt.Println("Data not ready, retrying...")
8180
return nil, NewRetryableError("data processing not complete")
8281
}
8382
fmt.Println("Data received, parsing...")

main.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@ package main
22

33
import (
44
"electric-usage-downloader/internal/app"
5-
"log"
65
)
76

87
func main() {
98
if err := app.Main(); err != nil {
10-
log.Fatal(err)
9+
panic(err)
1110
}
1211
}

0 commit comments

Comments
 (0)