File tree 2 files changed +9
-5
lines changed
2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -19,11 +19,11 @@ exports.prepareMetaData = meta=>{
19
19
// through cycling properties and `common.clone` doesn't copies them
20
20
return { message : meta . message , name : meta . name , stack : meta . stack } ;
21
21
}
22
- meta = common . clone ( meta ) ;
23
22
if ( typeof meta === 'object' && meta !== null ) {
24
- makeObjectNonCircular ( meta ) ;
23
+ meta = makeObjectNonCircular ( meta ) ;
25
24
cleanFieldNames ( meta ) ;
26
25
}
26
+ meta = common . clone ( meta ) ;
27
27
return meta ;
28
28
} ;
29
29
@@ -58,18 +58,22 @@ function cleanFieldNames(object) {
58
58
function makeObjectNonCircular ( node , opt_parents ) {
59
59
opt_parents = opt_parents || [ ] ;
60
60
opt_parents . push ( node ) ;
61
+ let copy = { } ;
61
62
for ( let key in node ) {
62
63
if ( ! Object . prototype . hasOwnProperty . call ( node , key ) ) {
63
64
continue ;
64
65
}
65
66
let value = node [ key ] ;
66
67
if ( typeof value === 'object' ) {
67
68
if ( opt_parents . indexOf ( value ) === - 1 ) {
68
- makeObjectNonCircular ( value , opt_parents ) ;
69
+ copy [ key ] = makeObjectNonCircular ( value , opt_parents ) ;
69
70
} else {
70
- node [ key ] = '[Circular]' ;
71
+ copy [ key ] = '[Circular]' ;
71
72
}
73
+ } else {
74
+ copy [ key ] = value ;
72
75
}
73
76
}
74
77
opt_parents . pop ( ) ;
78
+ return copy ;
75
79
}
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " winston-mongodb" ,
3
3
"license" : " MIT" ,
4
- "version" : " 2.0.2 " ,
4
+ "version" : " 2.0.3 " ,
5
5
"description" : " A MongoDB transport for winston" ,
6
6
"author" :
" Charlie Robbins <[email protected] >" ,
7
7
"contributors" : [
You can’t perform that action at this time.
0 commit comments