11import {
2- AttributeType ,
32 BacktraceAttachment ,
43 BacktraceAttachmentProvider ,
54 Breadcrumb ,
@@ -108,7 +107,7 @@ export class FileBreadcrumbsStorage implements BreadcrumbsStorage {
108107 timestamp : TimeHelper . now ( ) ,
109108 type : BreadcrumbType [ rawBreadcrumb . type ] . toLowerCase ( ) ,
110109 level : BreadcrumbLogLevel [ rawBreadcrumb . level ] . toLowerCase ( ) ,
111- attributes : this . prepareAttributes ( rawBreadcrumb . attributes ) ,
110+ attributes : rawBreadcrumb . attributes ,
112111 } ;
113112 const breadcrumbJson = JSON . stringify ( breadcrumb , jsonEscaper ( ) ) ;
114113 const jsonLength = breadcrumbJson . length + 1 ; // newline
@@ -123,46 +122,6 @@ export class FileBreadcrumbsStorage implements BreadcrumbsStorage {
123122 return id ;
124123 }
125124
126- private prepareAttributes ( attributes ?: Record < string , AttributeType > ) : Record < string , AttributeType > | undefined {
127- const result : Record < string , AttributeType > = { } ;
128- if ( ! attributes ) {
129- return undefined ;
130- }
131- for ( const key in attributes ) {
132- const value = attributes [ key ] ;
133- switch ( typeof value ) {
134- case 'number' :
135- case 'boolean' :
136- case 'string' :
137- case 'undefined' :
138- result [ key ] = value ;
139- break ;
140- case 'bigint' :
141- result [ key ] = ( value as bigint ) . toString ( ) ;
142- break ;
143- case 'object' : {
144- if ( ! value ) {
145- result [ key ] = value ;
146- break ;
147- }
148- const unknownValue = value as unknown ;
149- try {
150- if ( unknownValue instanceof Date ) {
151- result [ key ] = unknownValue . toISOString ( ) ;
152- } else if ( unknownValue instanceof URL ) {
153- result [ key ] = unknownValue . toString ( ) ;
154- }
155- } catch {
156- // revoked proxy or broken object — drop it
157- }
158- // drop all other objects
159- break ;
160- }
161- }
162- }
163- return result ;
164- }
165-
166125 private static getFileName ( index : number ) {
167126 return `${ FILE_PREFIX } -${ index } ` ;
168127 }
0 commit comments