From bed1c17b1ed57d84ed4c7f5865833b484b090ee5 Mon Sep 17 00:00:00 2001 From: Brian Kassouf Date: Tue, 25 Apr 2017 10:24:19 -0700 Subject: [PATCH] Update logging to new structure --- .../database/dbplugin/databasemiddleware.go | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/builtin/logical/database/dbplugin/databasemiddleware.go b/builtin/logical/database/dbplugin/databasemiddleware.go index 9ab35b740..13591e516 100644 --- a/builtin/logical/database/dbplugin/databasemiddleware.go +++ b/builtin/logical/database/dbplugin/databasemiddleware.go @@ -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() }