77import { DATADOG_MESSAGE_PREFIX , InternalLog } from '../InternalLog' ;
88import { SdkVerbosity } from '../SdkVerbosity' ;
99import type { DdNativeLogsType } from '../nativeModulesTypes' ;
10+ import { validateContext } from '../utils/argsUtils' ;
1011
1112import { generateEventMapper } from './eventMapper' ;
1213import type {
@@ -49,11 +50,11 @@ class DdLogsWrapper implements DdLogsType {
4950 args [ 1 ] ,
5051 args [ 2 ] ,
5152 args [ 3 ] ,
52- args [ 4 ] || { } ,
53+ validateContext ( args [ 4 ] ) ,
5354 'debug'
5455 ) ;
5556 }
56- return this . log ( args [ 0 ] , args [ 1 ] || { } , 'debug' ) ;
57+ return this . log ( args [ 0 ] , validateContext ( args [ 1 ] ) , 'debug' ) ;
5758 } ;
5859
5960 info = ( ...args : LogArguments | LogWithErrorArguments ) : Promise < void > => {
@@ -63,11 +64,11 @@ class DdLogsWrapper implements DdLogsType {
6364 args [ 1 ] ,
6465 args [ 2 ] ,
6566 args [ 3 ] ,
66- args [ 4 ] || { } ,
67+ validateContext ( args [ 4 ] ) ,
6768 'info'
6869 ) ;
6970 }
70- return this . log ( args [ 0 ] , args [ 1 ] || { } , 'info' ) ;
71+ return this . log ( args [ 0 ] , validateContext ( args [ 1 ] ) , 'info' ) ;
7172 } ;
7273
7374 warn = ( ...args : LogArguments | LogWithErrorArguments ) : Promise < void > => {
@@ -77,11 +78,11 @@ class DdLogsWrapper implements DdLogsType {
7778 args [ 1 ] ,
7879 args [ 2 ] ,
7980 args [ 3 ] ,
80- args [ 4 ] || { } ,
81+ validateContext ( args [ 4 ] ) ,
8182 'warn'
8283 ) ;
8384 }
84- return this . log ( args [ 0 ] , args [ 1 ] || { } , 'warn' ) ;
85+ return this . log ( args [ 0 ] , validateContext ( args [ 1 ] ) , 'warn' ) ;
8586 } ;
8687
8788 error = ( ...args : LogArguments | LogWithErrorArguments ) : Promise < void > => {
@@ -91,11 +92,11 @@ class DdLogsWrapper implements DdLogsType {
9192 args [ 1 ] ,
9293 args [ 2 ] ,
9394 args [ 3 ] ,
94- args [ 4 ] || { } ,
95+ validateContext ( args [ 4 ] ) ,
9596 'error'
9697 ) ;
9798 }
98- return this . log ( args [ 0 ] , args [ 1 ] || { } , 'error' ) ;
99+ return this . log ( args [ 0 ] , validateContext ( args [ 1 ] ) , 'error' ) ;
99100 } ;
100101
101102 /**
0 commit comments