|
@@ -104,8 +104,12 @@ function cacheLogs() {
|
|
|
let port = value.port
|
|
|
let n = 200
|
|
|
let messlist = value.messlist
|
|
|
- if (value.id !== -1 && port !== -1) {
|
|
|
- logger.info(`~~~缓存日志${value.id}`)
|
|
|
+ if (value.id !== -1 && port !== -1 && value.threadStatus === robot.RobotStatus.RUNNING) {
|
|
|
+ // 将数组转换为 JSON 字符串
|
|
|
+ const jsonString = JSON.stringify(messlist);
|
|
|
+ const byteSize = Buffer.byteLength(jsonString, 'utf8');
|
|
|
+ const megabyteSize = byteSize / (1024 * 1024);
|
|
|
+ logger.info(`~~~缓存日志${value.id}--占用大小:${megabyteSize} M`)
|
|
|
try {
|
|
|
var logPath = "./logs" + port
|
|
|
logger.info(`访问-日志相对目录:${logPath}`)
|
|
@@ -145,7 +149,10 @@ function cachePredictorState() {
|
|
|
let port = value.port
|
|
|
let predictorState = value.predictorState
|
|
|
if (value.id !== -1 && port !== -1 && value.threadStatus === robot.RobotStatus.RUNNING) {
|
|
|
- logger.info(`~~~缓存机器人状态详情${value.id}`)
|
|
|
+ const jsonString = JSON.stringify(messlist);
|
|
|
+ const byteSize = Buffer.byteLength(jsonString, 'utf8');
|
|
|
+ const megabyteSize = byteSize / (1024 * 1024);
|
|
|
+ logger.info(`~~~缓存机器人状态详情${value.id}--占用大小:${megabyteSize} M`)
|
|
|
var accUrl = "http://127.0.0.1:" + port
|
|
|
http.request_get(`${accUrl}/predictor_state`, {...config.headers})
|
|
|
.then((data) => {
|