@@ -5,7 +5,7 @@ import * as semver from "semver";
55
66export class PerformanceService implements IPerformanceService {
77 public static LOG_MESSAGE_TEMPLATE = `Execution of method "%s" took %s ms.` ;
8- public static FAIL_LOG_MESSAGE_TEMPLATE = `Failed to log pefromance data for method %s.` ;
8+ public static FAIL_LOG_MESSAGE_TEMPLATE = `Failed to log pefromance data in file for method %s.` ;
99 private static MIN_NODE_PERFORMANCE_MODULE_VERSION = "8.5.0" ;
1010 private performance : { now ( ) : number } = null ;
1111
@@ -59,7 +59,7 @@ export class PerformanceService implements IPerformanceService {
5959 let methodArgs ;
6060
6161 try {
62- methodArgs = JSON . stringify ( args , this . getCircularReplacer ( ) ) ;
62+ methodArgs = JSON . stringify ( args , this . getJsonSanitizer ( ) ) ;
6363 } catch ( e ) {
6464 methodArgs = "cyclic args" ;
6565 }
@@ -75,10 +75,12 @@ export class PerformanceService implements IPerformanceService {
7575 this . $fs . appendFile ( filePath , `${ JSON . stringify ( info ) } ${ EOL } ` ) ;
7676 } catch ( e ) {
7777 this . $logger . trace ( PerformanceService . FAIL_LOG_MESSAGE_TEMPLATE , methodInfo ) ;
78+ this . $logger . info ( PerformanceService . LOG_MESSAGE_TEMPLATE , methodInfo , executionTime ) ;
7879 }
7980 }
8081
81- private getCircularReplacer ( ) {
82+ //removes any injected members of the arguments and excludes the options object even if it was renamed
83+ private getJsonSanitizer ( ) {
8284 const seen = new WeakSet ( ) ;
8385 seen . add ( this . $options ) ;
8486 return ( key : any , value : any ) => {
0 commit comments