|
@@ -154,6 +154,7 @@ function MagicJS(scriptName = "MagicJS", logLevel = "INFO") {
|
|
|
this.notification.setBark(barkUrl);
|
|
this.notification.setBark(barkUrl);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ this.logger.log(`${scriptName}, 开始执行!`);
|
|
|
}
|
|
}
|
|
|
get isRequest() {
|
|
get isRequest() {
|
|
|
return typeof $request !== "undefined" && typeof $response === "undefined";
|
|
return typeof $request !== "undefined" && typeof $response === "undefined";
|
|
@@ -176,10 +177,22 @@ function MagicJS(scriptName = "MagicJS", logLevel = "INFO") {
|
|
|
return undefined;
|
|
return undefined;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ costTime() {
|
|
|
|
|
+ let info = `${this.scriptName}执行完毕!`
|
|
|
|
|
+ // if (this.isNode && this.isExecComm) {
|
|
|
|
|
+ // info = `指令【${this.comm[1]}】执行完毕!`
|
|
|
|
|
+ // }
|
|
|
|
|
+ this._endTime = new Date().getTime();
|
|
|
|
|
+ const ms = this._endTime - this._startTime;
|
|
|
|
|
+ const costTime = ms / 1000;
|
|
|
|
|
+ this.log(`${info}耗时【${costTime}】秒`);
|
|
|
|
|
+ }
|
|
|
done = (value = {}) => {
|
|
done = (value = {}) => {
|
|
|
- this._endTime = Date.now();
|
|
|
|
|
- let span = (this._endTime - this._startTime) / 1e3;
|
|
|
|
|
- this.logger.info(`SCRIPT COMPLETED: ${span} S.`);
|
|
|
|
|
|
|
+ // this._endTime = Date.now();
|
|
|
|
|
+ // let span = (this._endTime - this._startTime) / 1e3;
|
|
|
|
|
+ // this.logger.info(`SCRIPT COMPLETED: ${span} S.`);
|
|
|
|
|
+ this.costTime();
|
|
|
if (typeof $done !== "undefined") {
|
|
if (typeof $done !== "undefined") {
|
|
|
$done(value);
|
|
$done(value);
|
|
|
}
|
|
}
|