Skip to content

Commit f2918ee

Browse files
author
mgutz
committed
update logxi which fixes errors with errors not being passed when disabled
1 parent ff276aa commit f2918ee

File tree

8 files changed

+34
-33
lines changed

8 files changed

+34
-33
lines changed

glide.lock

Lines changed: 18 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

glide.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ import:
1010
- package: github.com/mgutz/jo
1111
subpackages:
1212
- v1
13-
- package: github.com/mgutz/logxi
14-
subpackages:
15-
- v1
1613
- package: github.com/mgutz/str
1714
- package: github.com/pmylund/go-cache
1815
- package: github.com/satori/go.uuid
@@ -22,4 +19,4 @@ import:
2219
- package: gopkg.in/stretchr/testify.v1
2320
subpackages:
2421
- assert
25-
22+
- package: github.com/mgutz/logxi

init.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import (
44
"fmt"
55
"strconv"
66

7-
"github.com/mgutz/logxi/v1"
7+
"github.com/mgutz/logxi"
88
)
99

10-
var logger log.Logger
10+
var logger logxi.Logger
1111

1212
// Strict tells dat to raise errors
1313
var Strict = false
@@ -53,5 +53,5 @@ func init() {
5353
identifierTab[i] = fmt.Sprintf("dat%d", i)
5454
}
5555

56-
logger = log.New("dat")
56+
logger = logxi.New("dat")
5757
}

kvs/init.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
package kvs
22

3-
import (
4-
"github.com/mgutz/logxi/v1"
5-
)
3+
import "github.com/mgutz/logxi"
64

7-
var logger log.Logger
5+
var logger logxi.Logger
86

97
func init() {
10-
logger = log.New("dat.cache")
8+
logger = logxi.New("dat.cache")
119
}

sqlx-runner/db.go

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

33
import (
44
"database/sql"
5-
"log"
65

76
"github.com/jmoiron/sqlx"
87
"gopkg.in/mgutz/dat.v1"
@@ -36,10 +35,10 @@ func pgMustNotAllowEscapeSequence(conn *DB) {
3635
}
3736

3837
if standardConformingStrings != "on" {
39-
log.Fatalf("Database allows escape sequences. Cannot be used with interpolation. "+
38+
logger.Fatal("Database allows escape sequences. Cannot be used with interpolation. "+
4039
"standard_conforming_strings=%q\n"+
4140
"See http://www.postgresql.org/docs/9.3/interactive/sql-syntax-lexical.html#SQL-SYNTAX-STRINGS-ESCAPE",
42-
standardConformingStrings)
41+
"standardConformingStrings", standardConformingStrings)
4342
}
4443
}
4544

sqlx-runner/init.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ import (
55
"time"
66

77
"github.com/cenkalti/backoff"
8-
"github.com/mgutz/logxi/v1"
8+
"github.com/mgutz/logxi"
99
"gopkg.in/mgutz/dat.v1"
1010
"gopkg.in/mgutz/dat.v1/kvs"
1111
"gopkg.in/mgutz/dat.v1/postgres"
1212
)
1313

14-
var logger log.Logger
14+
var logger logxi.Logger
1515

1616
// LogQueriesThreshold is the threshold for logging "slow" queries
1717
var LogQueriesThreshold time.Duration
@@ -21,7 +21,7 @@ var LogErrNoRows bool
2121

2222
func init() {
2323
dat.Dialect = postgres.New()
24-
logger = log.New("dat:sqlx")
24+
logger = logxi.New("dat:sqlx")
2525
}
2626

2727
// Cache caches query results.

sqlx-runner/init_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"os"
88
"time"
99

10-
"github.com/mgutz/logxi/v1"
10+
"github.com/mgutz/logxi"
1111

1212
"gopkg.in/mgutz/dat.v1"
1313
"gopkg.in/mgutz/dat.v1/kvs"
@@ -22,7 +22,7 @@ func init() {
2222
sqlDB = realDb()
2323
testDB = NewDB(sqlDB, "postgres")
2424
dat.Strict = false
25-
log.Suppress(true)
25+
logxi.Suppress(true)
2626

2727
Cache = kvs.NewMemoryKeyValueStore(1 * time.Second)
2828
//Cache, _ = kvs.NewDefaultRedisStore()

sqlx-runner/tx.go

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

33
import (
44
"errors"
5-
"log"
65
"sync"
76
"time"
87

@@ -138,7 +137,7 @@ func (tx *Tx) AutoCommit() error {
138137
if err != nil {
139138
tx.state = txErred
140139
if dat.Strict {
141-
log.Fatalf("Could not commit transaction: %s\n", err.Error())
140+
logger.Fatal("Could not commit transaction", "err", err)
142141
}
143142
tx.popState()
144143
return logger.Error("transaction.AutoCommit.commit_error", err)
@@ -163,7 +162,7 @@ func (tx *Tx) AutoRollback() error {
163162
if err != nil {
164163
tx.state = txErred
165164
if dat.Strict {
166-
log.Fatalf("Could not rollback transaction: %s\n", err.Error())
165+
logger.Fatal("Could not rollback transaction", "err", err)
167166
}
168167
tx.popState()
169168
return logger.Error("transaction.AutoRollback.rollback_error", err)

0 commit comments

Comments
 (0)