diff --git a/pkg/logger/logger.go b/pkg/logger/logger.go index 7b5f0217b..95fdc6a07 100644 --- a/pkg/logger/logger.go +++ b/pkg/logger/logger.go @@ -49,7 +49,7 @@ func NewOCMLogger(ctx context.Context) OCMLogger { func (l *logger) prepareLogPrefix(message string, extra extra) string { prefix := " " - if txid, ok := l.context.Value("txid").(int64); ok { + if txid, ok := l.context.Value(TxIDKey).(int64); ok { prefix = fmt.Sprintf("[tx_id=%d]%s", txid, prefix) } @@ -73,7 +73,7 @@ func (l *logger) prepareLogPrefixf(format string, args ...interface{}) string { orig := fmt.Sprintf(format, args...) prefix := " " - if txid, ok := l.context.Value("txid").(int64); ok { + if txid, ok := l.context.Value(TxIDKey).(int64); ok { prefix = fmt.Sprintf("[tx_id=%d]%s", txid, prefix) } diff --git a/pkg/logger/operationid_middleware.go b/pkg/logger/operationid_middleware.go index 4ff2237fc..bae9f8f01 100644 --- a/pkg/logger/operationid_middleware.go +++ b/pkg/logger/operationid_middleware.go @@ -9,8 +9,10 @@ import ( ) type OperationIDKey string +type TransactionIDKey string -const OpIDKey OperationIDKey = "opID" +const OpIDKey OperationIDKey = "op_id" +const TxIDKey TransactionIDKey = "tx_id" const OpIDHeader OperationIDKey = "X-Operation-ID" // OperationIDMiddleware Middleware wraps the given HTTP handler so that the details of the request are sent to the log.