Skip to content

Commit d439289

Browse files
author
Ian Pye
committed
Updating to use new log format
1 parent 392e7b4 commit d439289

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

cube/pg/executor.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ package pg
33
import (
44
"database/sql/driver"
55
"github.com/cevian/pq"
6-
"log"
76
"reflect"
87
"stash.cloudflare.com/go-stream/cube"
8+
"stash.cloudflare.com/go-stream/util/slog"
99
)
1010

1111
type Executor struct {
@@ -25,7 +25,7 @@ func (e *Executor) ExecErr(sql string, args ...interface{}) (driver.Result, erro
2525
var err error
2626
dargs[n], err = driver.DefaultParameterConverter.ConvertValue(arg)
2727
if err != nil {
28-
log.Fatalf("sql: converting Exec argument #%d's type: %v", n, err)
28+
slog.Fatalf("sql: converting Exec argument #%d's type: %v", n, err)
2929
}
3030
}
3131
return exec.Exec(sql, dargs)
@@ -34,7 +34,7 @@ func (e *Executor) ExecErr(sql string, args ...interface{}) (driver.Result, erro
3434
func (e *Executor) Exec(sql string, args ...interface{}) driver.Result {
3535
res, err := e.ExecErr(sql, args...)
3636
if err != nil {
37-
log.Fatal("Sql:", sql, "Err:", err)
37+
slog.Fatalf("Sql: %v Err: %v", sql, err)
3838
}
3939
return res
4040
}
@@ -68,7 +68,7 @@ func getPartition(p cube.Partition) Partition {
6868
case cube.TimePartition:
6969
return &TimePartition{&pt}
7070
default:
71-
log.Fatal("Unknown Partition Type", reflect.TypeOf(pt))
71+
slog.Fatalf("Unknown Partition Type %v", reflect.TypeOf(pt))
7272
}
7373
panic("Never Here")
7474
}
@@ -84,7 +84,7 @@ func (e *Executor) UpsertCube(p cube.Partition, c cube.Cuber) {
8484
func (e *Executor) UpsertCubes(p cube.Partition, c []cube.Cuber) {
8585
tx, err := e.conn.Begin()
8686
if err != nil {
87-
log.Fatal("Error starting transaction", err)
87+
slog.Fatalf("Error starting transaction %v", err)
8888
}
8989

9090
part := getPartition(p)
@@ -96,26 +96,26 @@ func (e *Executor) UpsertCubes(p cube.Partition, c []cube.Cuber) {
9696
cy := pq.NewCopierFromConn(e.conn)
9797
err = cy.Start(e.table.CopyTableSql(part))
9898
if err != nil {
99-
log.Fatal("Error starting copy", err)
99+
slog.Fatalf("Error starting copy %v", err)
100100
}
101101

102102
for _, cube := range c {
103103
err = cy.Send(e.table.CopyDataFull(cube))
104104
if err != nil {
105-
log.Fatal("Error copying ", err)
105+
slog.Fatalf("Error copying %v", err)
106106
}
107107
}
108108

109109
err = cy.Close()
110110
if err != nil {
111-
log.Fatal("Error Ending Copy ", err)
111+
slog.Fatalf("Error Ending Copy %v", err)
112112
}
113113

114114
e.Exec(e.table.MergeCopySql(part))
115115

116116
err = tx.Commit()
117117
if err != nil {
118-
log.Fatal("Error Committing tx ", err)
118+
slog.Fatalf("Error Committing tx %v ", err)
119119
}
120120

121121
}

0 commit comments

Comments
 (0)