Add transactionId to SqlLogger
This commit is contained in:
parent
02d072a361
commit
76bf7d8d47
@ -2,6 +2,7 @@ import {ILogger} from './ILogger'
|
|||||||
import {Logger, QueryRunner} from 'typeorm'
|
import {Logger, QueryRunner} from 'typeorm'
|
||||||
import {Namespace} from 'cls-hooked'
|
import {Namespace} from 'cls-hooked'
|
||||||
import {CORRELATION_ID} from '../middleware/Transaction'
|
import {CORRELATION_ID} from '../middleware/Transaction'
|
||||||
|
import { TRANSACTION_ID } from '../database'
|
||||||
|
|
||||||
export class SqlLogger implements Logger {
|
export class SqlLogger implements Logger {
|
||||||
constructor(
|
constructor(
|
||||||
@ -80,8 +81,9 @@ export class SqlLogger implements Logger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected getCorrelationId(): string | undefined {
|
protected getCorrelationId(): string | undefined {
|
||||||
const correlationId: string = this.ns.get(CORRELATION_ID)
|
const correlationId: string = this.ns.get(CORRELATION_ID) || '-'
|
||||||
return correlationId || ''
|
const transactionId: string = this.ns.get(TRANSACTION_ID) || '-'
|
||||||
|
return correlationId + ' ' + transactionId
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user