Update logging to new structure
This commit is contained in:
parent
b52b410a47
commit
bed1c17b1e
|
@ -25,10 +25,10 @@ func (mw *databaseTracingMiddleware) Type() (string, error) {
|
|||
func (mw *databaseTracingMiddleware) CreateUser(statements Statements, usernamePrefix string, expiration time.Time) (username string, password string, err error) {
|
||||
if mw.logger.IsTrace() {
|
||||
defer func(then time.Time) {
|
||||
mw.logger.Trace("database/CreateUser: finished", "type", mw.typeStr, "err", err, "took", time.Since(then))
|
||||
mw.logger.Trace("database", "operation", "CreateUser", "status", "finished", "type", mw.typeStr, "err", err, "took", time.Since(then))
|
||||
}(time.Now())
|
||||
|
||||
mw.logger.Trace("database/CreateUser: starting", "type", mw.typeStr)
|
||||
mw.logger.Trace("database", "operation", "CreateUser", "status", "started", "type", mw.typeStr)
|
||||
}
|
||||
return mw.next.CreateUser(statements, usernamePrefix, expiration)
|
||||
}
|
||||
|
@ -36,10 +36,10 @@ func (mw *databaseTracingMiddleware) CreateUser(statements Statements, usernameP
|
|||
func (mw *databaseTracingMiddleware) RenewUser(statements Statements, username string, expiration time.Time) (err error) {
|
||||
if mw.logger.IsTrace() {
|
||||
defer func(then time.Time) {
|
||||
mw.logger.Trace("database/RenewUser: finished", "type", mw.typeStr, "err", err, "took", time.Since(then))
|
||||
mw.logger.Trace("database", "operation", "RenewUser", "status", "finished", "type", mw.typeStr, "err", err, "took", time.Since(then))
|
||||
}(time.Now())
|
||||
|
||||
mw.logger.Trace("database/RenewUser: starting", "type", mw.typeStr)
|
||||
mw.logger.Trace("database", "operation", "RenewUser", "status", "started", mw.typeStr)
|
||||
}
|
||||
return mw.next.RenewUser(statements, username, expiration)
|
||||
}
|
||||
|
@ -47,10 +47,10 @@ func (mw *databaseTracingMiddleware) RenewUser(statements Statements, username s
|
|||
func (mw *databaseTracingMiddleware) RevokeUser(statements Statements, username string) (err error) {
|
||||
if mw.logger.IsTrace() {
|
||||
defer func(then time.Time) {
|
||||
mw.logger.Trace("database/RevokeUser: finished", "type", mw.typeStr, "err", err, "took", time.Since(then))
|
||||
mw.logger.Trace("database", "operation", "RevokeUser", "status", "finished", "type", mw.typeStr, "err", err, "took", time.Since(then))
|
||||
}(time.Now())
|
||||
|
||||
mw.logger.Trace("database/RevokeUser: starting", "type", mw.typeStr)
|
||||
mw.logger.Trace("database", "operation", "RevokeUser", "status", "started", "type", mw.typeStr)
|
||||
}
|
||||
return mw.next.RevokeUser(statements, username)
|
||||
}
|
||||
|
@ -58,10 +58,10 @@ func (mw *databaseTracingMiddleware) RevokeUser(statements Statements, username
|
|||
func (mw *databaseTracingMiddleware) Initialize(conf map[string]interface{}, verifyConnection bool) (err error) {
|
||||
if mw.logger.IsTrace() {
|
||||
defer func(then time.Time) {
|
||||
mw.logger.Trace("database/Initialize: finished", "type", mw.typeStr, "verify", verifyConnection, "err", err, "took", time.Since(then))
|
||||
mw.logger.Trace("database", "operation", "Initialize", "status", "finished", "type", mw.typeStr, "verify", verifyConnection, "err", err, "took", time.Since(then))
|
||||
}(time.Now())
|
||||
|
||||
mw.logger.Trace("database/Initialize: starting", "type", mw.typeStr)
|
||||
mw.logger.Trace("database", "operation", "Initialize", "status", "started", "type", mw.typeStr)
|
||||
}
|
||||
return mw.next.Initialize(conf, verifyConnection)
|
||||
}
|
||||
|
@ -69,10 +69,10 @@ func (mw *databaseTracingMiddleware) Initialize(conf map[string]interface{}, ver
|
|||
func (mw *databaseTracingMiddleware) Close() (err error) {
|
||||
if mw.logger.IsTrace() {
|
||||
defer func(then time.Time) {
|
||||
mw.logger.Trace("database/Close: finished", "type", mw.typeStr, "err", err, "took", time.Since(then))
|
||||
mw.logger.Trace("database", "operation", "Close", "status", "finished", "type", mw.typeStr, "err", err, "took", time.Since(then))
|
||||
}(time.Now())
|
||||
|
||||
mw.logger.Trace("database/Close: starting", "type", mw.typeStr)
|
||||
mw.logger.Trace("database", "operation", "Close", "status", "started", "type", mw.typeStr)
|
||||
}
|
||||
return mw.next.Close()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue