@@ -5,7 +5,7 @@ import * as semver from "semver";
5
5
6
6
export class PerformanceService implements IPerformanceService {
7
7
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.` ;
9
9
private static MIN_NODE_PERFORMANCE_MODULE_VERSION = "8.5.0" ;
10
10
private performance : { now ( ) : number } = null ;
11
11
@@ -59,7 +59,7 @@ export class PerformanceService implements IPerformanceService {
59
59
let methodArgs ;
60
60
61
61
try {
62
- methodArgs = JSON . stringify ( args , this . getCircularReplacer ( ) ) ;
62
+ methodArgs = JSON . stringify ( args , this . getJsonSanitizer ( ) ) ;
63
63
} catch ( e ) {
64
64
methodArgs = "cyclic args" ;
65
65
}
@@ -75,10 +75,12 @@ export class PerformanceService implements IPerformanceService {
75
75
this . $fs . appendFile ( filePath , `${ JSON . stringify ( info ) } ${ EOL } ` ) ;
76
76
} catch ( e ) {
77
77
this . $logger . trace ( PerformanceService . FAIL_LOG_MESSAGE_TEMPLATE , methodInfo ) ;
78
+ this . $logger . info ( PerformanceService . LOG_MESSAGE_TEMPLATE , methodInfo , executionTime ) ;
78
79
}
79
80
}
80
81
81
- private getCircularReplacer ( ) {
82
+ //removes any injected members of the arguments and excludes the options object even if it was renamed
83
+ private getJsonSanitizer ( ) {
82
84
const seen = new WeakSet ( ) ;
83
85
seen . add ( this . $options ) ;
84
86
return ( key : any , value : any ) => {
0 commit comments