Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand All @@ -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)
}

Expand Down
4 changes: 3 additions & 1 deletion pkg/logger/operationid_middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down