@@ -57,22 +57,9 @@ export class PerformanceService implements IPerformanceService {
5757
5858 private logDataToFile ( filePath : string , methodInfo : string , executionTime : number , args : any [ ] ) {
5959 let methodArgs ;
60- const getCircularReplacer = ( ) => {
61- const seen = new WeakSet ( ) ;
62- seen . add ( this . $options ) ;
63- return ( key : any , value : any ) => {
64- if ( typeof value === "object" && value !== null ) {
65- if ( seen . has ( value ) || _ . startsWith ( key , "$" ) ) {
66- return ;
67- }
68- seen . add ( value ) ;
69- }
70- return value ;
71- } ;
72- } ;
7360
7461 try {
75- methodArgs = JSON . stringify ( args , getCircularReplacer ( ) ) ;
62+ methodArgs = JSON . stringify ( args , this . getCircularReplacer ( ) ) ;
7663 } catch ( e ) {
7764 methodArgs = "cyclic args" ;
7865 }
@@ -90,6 +77,20 @@ export class PerformanceService implements IPerformanceService {
9077 this . $logger . trace ( PerformanceService . FAIL_LOG_MESSAGE_TEMPLATE , methodInfo ) ;
9178 }
9279 }
80+
81+ private getCircularReplacer ( ) {
82+ const seen = new WeakSet ( ) ;
83+ seen . add ( this . $options ) ;
84+ return ( key : any , value : any ) => {
85+ if ( typeof value === "object" && value !== null ) {
86+ if ( seen . has ( value ) || _ . startsWith ( key , "$" ) ) {
87+ return ;
88+ }
89+ seen . add ( value ) ;
90+ }
91+ return value ;
92+ } ;
93+ }
9394}
9495
9596$injector . register ( 'performanceService' , PerformanceService ) ;
0 commit comments