File tree Expand file tree Collapse file tree
packages/node-core/src/logs Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,7 +34,8 @@ export type CaptureLogArgs = CaptureLogArgWithTemplate | CaptureLogArgWithoutTem
3434export function captureLog ( level : LogSeverityLevel , ...args : CaptureLogArgs ) : void {
3535 const [ messageOrMessageTemplate , paramsOrAttributes , maybeAttributesOrMetadata , maybeMetadata ] = args ;
3636 if ( Array . isArray ( paramsOrAttributes ) ) {
37- const attributes = { ...( maybeAttributesOrMetadata as Log [ 'attributes' ] ) } ;
37+ // type-casting here because from the type definitions we know that `maybeAttributesOrMetadata` is an attributes object (or undefined)
38+ const attributes = { ...( maybeAttributesOrMetadata as Log [ 'attributes' ] | undefined ) } ;
3839 attributes [ 'sentry.message.template' ] = messageOrMessageTemplate ;
3940 paramsOrAttributes . forEach ( ( param , index ) => {
4041 attributes [ `sentry.message.parameter.${ index } ` ] = param ;
@@ -44,7 +45,8 @@ export function captureLog(level: LogSeverityLevel, ...args: CaptureLogArgs): vo
4445 } else {
4546 _INTERNAL_captureLog (
4647 { level, message : messageOrMessageTemplate , attributes : paramsOrAttributes } ,
47- maybeMetadata ?. scope ,
48+ // type-casting here because from the type definitions we know that `maybeAttributesOrMetadata` is a metadata object (or undefined)
49+ ( maybeAttributesOrMetadata as CaptureLogMetadata | undefined ) ?. scope ?? maybeMetadata ?. scope ,
4850 ) ;
4951 }
5052}
You can’t perform that action at this time.
0 commit comments