From 88a978de41d27519862aa9328dd7c568ce97e8c5 Mon Sep 17 00:00:00 2001 From: Nicolas Ulrich Date: Tue, 12 Nov 2024 17:35:01 +0100 Subject: [PATCH] Add @session.id in Logs along to @session_id --- packages/logs/src/boot/startLogs.spec.ts | 3 +++ packages/logs/src/domain/assembly.ts | 1 + packages/logs/src/logsEvent.types.ts | 13 ++++++++++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/packages/logs/src/boot/startLogs.spec.ts b/packages/logs/src/boot/startLogs.spec.ts index 01102925e6..5d543d10fa 100644 --- a/packages/logs/src/boot/startLogs.spec.ts +++ b/packages/logs/src/boot/startLogs.spec.ts @@ -108,6 +108,9 @@ describe('logs', () => { message: 'message', service: 'service', session_id: jasmine.any(String), + session: { + id: jasmine.any(String), + }, status: StatusType.warn, view: { referrer: 'common_referrer', diff --git a/packages/logs/src/domain/assembly.ts b/packages/logs/src/domain/assembly.ts index ec68c5c212..7c8ee33395 100644 --- a/packages/logs/src/domain/assembly.ts +++ b/packages/logs/src/domain/assembly.ts @@ -40,6 +40,7 @@ export function startLogsAssembly( { service: configuration.service, session_id: session ? session.id : undefined, + session: session ? { id: session.id } : undefined, // Insert user first to allow overrides from global context usr: !isEmptyObject(commonContext.user) ? commonContext.user : undefined, view: commonContext.view, diff --git a/packages/logs/src/logsEvent.types.ts b/packages/logs/src/logsEvent.types.ts index cddd52566d..f537feef0a 100644 --- a/packages/logs/src/logsEvent.types.ts +++ b/packages/logs/src/logsEvent.types.ts @@ -24,9 +24,20 @@ export interface LogsEvent { */ service?: string /** - * UUID of the session + * UUID of the session (deprecated in favor of session.id) */ session_id?: string + /** + * Session properties + */ + session?: { + /** + * UUID of the session + */ + id?: string + + [k: string]: unknown + } /** * View properties */