agora-foundation 3.9.1 → 3.10.0-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -32,7 +32,7 @@ var LoggerImpl = exports.LoggerImpl = /*#__PURE__*/function () {
|
|
|
32
32
|
var path = window.require('path');
|
|
33
33
|
var _window$require = window.require('@electron/remote'),
|
|
34
34
|
app = _window$require.app;
|
|
35
|
-
var logFolderPath = path.resolve(app.getPath('logs'), 'logs'
|
|
35
|
+
var logFolderPath = path.resolve(app.getPath('logs'), 'logs');
|
|
36
36
|
var maxFiles = _opts.maxFiles || 5;
|
|
37
37
|
var maxSize = _opts.maxSize || 512;
|
|
38
38
|
_logWorkerInteractor.addFsLogger(_label, logFolderPath, maxFiles, maxSize);
|
|
@@ -98,7 +98,7 @@ var createRotateTransport = exports.createRotateTransport = function createRotat
|
|
|
98
98
|
this.currentStream.end();
|
|
99
99
|
}
|
|
100
100
|
var filename = this.generateLogFilename();
|
|
101
|
-
this.currentFile = this.path.join(this.logFolderPath, filename);
|
|
101
|
+
this.currentFile = this.path.join(this.logFolderPath, this.filenamePrefix, filename);
|
|
102
102
|
console.log("[CustomRotateTransport] Creating new log file: ".concat(this.currentFile));
|
|
103
103
|
var dirPath = this.path.dirname(this.currentFile);
|
|
104
104
|
if (!this.fs.existsSync(dirPath)) {
|
|
@@ -110,6 +110,7 @@ var createRotateTransport = exports.createRotateTransport = function createRotat
|
|
|
110
110
|
flags: 'a'
|
|
111
111
|
});
|
|
112
112
|
this.currentSize = this.fs.existsSync(this.currentFile) ? this.fs.statSync(this.currentFile).size : 0;
|
|
113
|
+
this.cleanupOldFiles();
|
|
113
114
|
}
|
|
114
115
|
|
|
115
116
|
/**
|
|
@@ -138,7 +139,6 @@ var createRotateTransport = exports.createRotateTransport = function createRotat
|
|
|
138
139
|
callback();
|
|
139
140
|
_this2.writing = false;
|
|
140
141
|
_this2.processQueue();
|
|
141
|
-
_this2.cleanupOldFiles();
|
|
142
142
|
});
|
|
143
143
|
return;
|
|
144
144
|
}
|
|
@@ -156,6 +156,10 @@ var createRotateTransport = exports.createRotateTransport = function createRotat
|
|
|
156
156
|
if (actualSize + buffer.length > this.maxSize) {
|
|
157
157
|
console.log("[CustomRotateTransport] actualSize (".concat(actualSize, ") + buffer.length (").concat(buffer.length, ") > maxSize (").concat(this.maxSize, "), rotate."));
|
|
158
158
|
this.createNewLogFile();
|
|
159
|
+
// 强制清理,确保文件数量不超过限制
|
|
160
|
+
setImmediate(function () {
|
|
161
|
+
return _this2.cleanupOldFiles();
|
|
162
|
+
});
|
|
159
163
|
}
|
|
160
164
|
this.currentStream.write(buffer, function () {
|
|
161
165
|
try {
|
|
@@ -166,7 +170,6 @@ var createRotateTransport = exports.createRotateTransport = function createRotat
|
|
|
166
170
|
callback();
|
|
167
171
|
_this2.writing = false;
|
|
168
172
|
_this2.processQueue();
|
|
169
|
-
_this2.cleanupOldFiles();
|
|
170
173
|
});
|
|
171
174
|
}
|
|
172
175
|
|
|
@@ -24,7 +24,7 @@ export var LoggerImpl = /*#__PURE__*/function () {
|
|
|
24
24
|
var path = window.require('path');
|
|
25
25
|
var _window$require = window.require('@electron/remote'),
|
|
26
26
|
app = _window$require.app;
|
|
27
|
-
var logFolderPath = path.resolve(app.getPath('logs'), 'logs'
|
|
27
|
+
var logFolderPath = path.resolve(app.getPath('logs'), 'logs');
|
|
28
28
|
var maxFiles = _opts.maxFiles || 5;
|
|
29
29
|
var maxSize = _opts.maxSize || 512;
|
|
30
30
|
_logWorkerInteractor.addFsLogger(_label, logFolderPath, maxFiles, maxSize);
|
|
@@ -90,7 +90,7 @@ export var createRotateTransport = function createRotateTransport(filenamePrefix
|
|
|
90
90
|
this.currentStream.end();
|
|
91
91
|
}
|
|
92
92
|
var filename = this.generateLogFilename();
|
|
93
|
-
this.currentFile = this.path.join(this.logFolderPath, filename);
|
|
93
|
+
this.currentFile = this.path.join(this.logFolderPath, this.filenamePrefix, filename);
|
|
94
94
|
console.log("[CustomRotateTransport] Creating new log file: ".concat(this.currentFile));
|
|
95
95
|
var dirPath = this.path.dirname(this.currentFile);
|
|
96
96
|
if (!this.fs.existsSync(dirPath)) {
|
|
@@ -102,6 +102,7 @@ export var createRotateTransport = function createRotateTransport(filenamePrefix
|
|
|
102
102
|
flags: 'a'
|
|
103
103
|
});
|
|
104
104
|
this.currentSize = this.fs.existsSync(this.currentFile) ? this.fs.statSync(this.currentFile).size : 0;
|
|
105
|
+
this.cleanupOldFiles();
|
|
105
106
|
}
|
|
106
107
|
|
|
107
108
|
/**
|
|
@@ -130,7 +131,6 @@ export var createRotateTransport = function createRotateTransport(filenamePrefix
|
|
|
130
131
|
callback();
|
|
131
132
|
_this2.writing = false;
|
|
132
133
|
_this2.processQueue();
|
|
133
|
-
_this2.cleanupOldFiles();
|
|
134
134
|
});
|
|
135
135
|
return;
|
|
136
136
|
}
|
|
@@ -148,6 +148,10 @@ export var createRotateTransport = function createRotateTransport(filenamePrefix
|
|
|
148
148
|
if (actualSize + buffer.length > this.maxSize) {
|
|
149
149
|
console.log("[CustomRotateTransport] actualSize (".concat(actualSize, ") + buffer.length (").concat(buffer.length, ") > maxSize (").concat(this.maxSize, "), rotate."));
|
|
150
150
|
this.createNewLogFile();
|
|
151
|
+
// 强制清理,确保文件数量不超过限制
|
|
152
|
+
setImmediate(function () {
|
|
153
|
+
return _this2.cleanupOldFiles();
|
|
154
|
+
});
|
|
151
155
|
}
|
|
152
156
|
this.currentStream.write(buffer, function () {
|
|
153
157
|
try {
|
|
@@ -158,7 +162,6 @@ export var createRotateTransport = function createRotateTransport(filenamePrefix
|
|
|
158
162
|
callback();
|
|
159
163
|
_this2.writing = false;
|
|
160
164
|
_this2.processQueue();
|
|
161
|
-
_this2.cleanupOldFiles();
|
|
162
165
|
});
|
|
163
166
|
}
|
|
164
167
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agora-foundation",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.10.0-alpha",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib-es/index.js",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@types/jasmine": "^5.1.4",
|
|
25
25
|
"@types/lodash": "^4.14.168",
|
|
26
26
|
"@types/node": "^20.11.30",
|
|
27
|
-
"agora-toolchain": "3.
|
|
27
|
+
"agora-toolchain": "3.10.0-alpha",
|
|
28
28
|
"core-js": "^3.33.3",
|
|
29
29
|
"tslib": "^2.6.2",
|
|
30
30
|
"winston": "^3.16.0",
|