agora-foundation 3.6.4 → 3.7.0

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.
@@ -6,6 +6,7 @@ export declare const createLogger: (opts?: {
6
6
  label?: string;
7
7
  prefix?: string;
8
8
  database?: boolean;
9
+ maxFiles?: number;
9
10
  }) => Logger;
10
11
  export declare const getLogManager: () => LogManager;
11
12
  export declare const setLogLevel: (_logLevel: LogLevel) => void;
@@ -47,7 +47,7 @@ var _constants = require("./constants");
47
47
  var logLevel = _type.LogLevel.DEBUG;
48
48
  var getLogger = exports.getLogger = function getLogger() {
49
49
  var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
50
- var label = opts.label || 'default';
50
+ var label = opts.label || 'agora-default';
51
51
  if (!_common.loggerRegistrar.has(label)) {
52
52
  _common.loggerLabels.add(label);
53
53
  _common.loggerRegistrar.set(label, new _loggerImpl.LoggerImpl(label, {}, {
@@ -59,7 +59,7 @@ var getLogger = exports.getLogger = function getLogger() {
59
59
  };
60
60
  var createLogger = exports.createLogger = function createLogger() {
61
61
  var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
62
- var label = opts.label || 'default';
62
+ var label = opts.label || 'agora-default';
63
63
  var databaseValue = (0, _isBoolean["default"])(opts.database) ? opts.database : true;
64
64
  var logger = new _loggerImpl.LoggerImpl(label, opts, {
65
65
  console: true,
@@ -7,6 +7,7 @@ export declare class LoggerImpl implements Logger {
7
7
  private _logWorkerInteractor;
8
8
  constructor(_label: string, _opts: {
9
9
  prefix?: string;
10
+ maxFiles?: number;
10
11
  }, _dest: {
11
12
  console: boolean;
12
13
  database: boolean;
@@ -33,7 +33,8 @@ var LoggerImpl = exports.LoggerImpl = /*#__PURE__*/function () {
33
33
  var _window$require = window.require('@electron/remote'),
34
34
  app = _window$require.app;
35
35
  var logFolderPath = path.resolve(app.getPath('logs'), 'logs');
36
- _logWorkerInteractor.addFsLogger(_label, logFolderPath);
36
+ var maxFiles = _opts.maxFiles || 5;
37
+ _logWorkerInteractor.addFsLogger(_label, logFolderPath, maxFiles);
37
38
  } else {
38
39
  this.warn('window.require is not present, logWorkerInteractor.addFsLogger cannot proceed');
39
40
  }
@@ -22,5 +22,5 @@ export interface LogWorkerInteractor {
22
22
  lastId: number;
23
23
  }>;
24
24
  deleteLogs(labels: string[], lastId: number): Promise<void>;
25
- addFsLogger(label: string, logFolderPath: string): void;
25
+ addFsLogger(label: string, logFolderPath: string, maxFiles: number): void;
26
26
  }
@@ -126,11 +126,12 @@ var AgoraUploadScheduler = exports.AgoraUploadScheduler = /*#__PURE__*/function
126
126
  case 5:
127
127
  _context.prev = 5;
128
128
  _t = _context["catch"](3);
129
- this._eventEmitter.emit('upload-failure', _t, task);
130
129
  retries = this._taskRetries.get(task) || 0;
131
130
  if (retries < this._maxRetries) {
132
131
  this._taskRetries.set(task, retries + 1);
133
132
  this._taskQueue.unshift(task);
133
+ } else {
134
+ this._eventEmitter.emit('upload-failure', _t, task);
134
135
  }
135
136
  case 6:
136
137
  _context.prev = 6;
@@ -0,0 +1,6 @@
1
+ import type winstonType from 'winston';
2
+ export declare const createRotateTransport: (filenamePrefix: string, logFolderPath: string, options?: {
3
+ level?: string;
4
+ maxSize?: number;
5
+ maxFiles?: number;
6
+ }) => winstonType.transport;
@@ -0,0 +1,238 @@
1
+ "use strict";
2
+
3
+ require("core-js/modules/es.object.define-property.js");
4
+ require("core-js/modules/es.reflect.construct.js");
5
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
6
+ Object.defineProperty(exports, "__esModule", {
7
+ value: true
8
+ });
9
+ exports.createRotateTransport = void 0;
10
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
12
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
13
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
14
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
15
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
16
+ require("core-js/modules/es.array.concat.js");
17
+ require("core-js/modules/es.array.filter.js");
18
+ require("core-js/modules/es.array.for-each.js");
19
+ require("core-js/modules/es.array.join.js");
20
+ require("core-js/modules/es.array.map.js");
21
+ require("core-js/modules/es.array.push.js");
22
+ require("core-js/modules/es.array.slice.js");
23
+ require("core-js/modules/es.array.sort.js");
24
+ require("core-js/modules/es.date.to-string.js");
25
+ require("core-js/modules/es.object.to-string.js");
26
+ require("core-js/modules/es.string.ends-with.js");
27
+ require("core-js/modules/es.string.pad-start.js");
28
+ require("core-js/modules/es.string.starts-with.js");
29
+ require("core-js/modules/esnext.iterator.constructor.js");
30
+ require("core-js/modules/esnext.iterator.filter.js");
31
+ require("core-js/modules/esnext.iterator.for-each.js");
32
+ require("core-js/modules/esnext.iterator.map.js");
33
+ require("core-js/modules/web.dom-collections.for-each.js");
34
+ require("core-js/modules/web.immediate.js");
35
+ function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
36
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
37
+ var formatTimestamp = function formatTimestamp() {
38
+ var date = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Date();
39
+ var year = date.getFullYear();
40
+ var month = String(date.getMonth() + 1).padStart(2, '0');
41
+ var day = String(date.getDate()).padStart(2, '0');
42
+ var hours = String(date.getHours()).padStart(2, '0');
43
+ var minutes = String(date.getMinutes()).padStart(2, '0');
44
+ var seconds = String(date.getSeconds()).padStart(2, '0');
45
+ return "".concat(year).concat(month).concat(day).concat(hours).concat(minutes).concat(seconds);
46
+ };
47
+ var createRotateTransport = exports.createRotateTransport = function createRotateTransport(filenamePrefix, logFolderPath) {
48
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
49
+ var WinstonTransport = require('winston-transport');
50
+ var CustomRotateTransport = /*#__PURE__*/function (_WinstonTransport) {
51
+ function CustomRotateTransport(opts) {
52
+ var _this;
53
+ (0, _classCallCheck2["default"])(this, CustomRotateTransport);
54
+ _this = _callSuper(this, CustomRotateTransport, [{
55
+ level: opts.level || 'info'
56
+ }]);
57
+ (0, _defineProperty2["default"])(_this, "currentFile", '');
58
+ (0, _defineProperty2["default"])(_this, "currentStream", null);
59
+ (0, _defineProperty2["default"])(_this, "currentSize", 0);
60
+ (0, _defineProperty2["default"])(_this, "writeQueue", []);
61
+ (0, _defineProperty2["default"])(_this, "writing", false);
62
+ (0, _defineProperty2["default"])(_this, "lastTimestamp", '');
63
+ (0, _defineProperty2["default"])(_this, "rotateIndex", 0);
64
+ _this.filenamePrefix = opts.filenamePrefix;
65
+ _this.logFolderPath = opts.logFolderPath;
66
+ _this.maxSize = opts.maxSize || 1024 * 1024;
67
+ _this.maxFiles = opts.maxFiles || 5;
68
+ _this.level = opts.level || 'info';
69
+ _this.fs = require('fs');
70
+ _this.path = require('path');
71
+ return _this;
72
+ }
73
+
74
+ /**
75
+ * 生成唯一的日志文件名,避免同一秒多次轮转导致的覆盖
76
+ */
77
+ (0, _inherits2["default"])(CustomRotateTransport, _WinstonTransport);
78
+ return (0, _createClass2["default"])(CustomRotateTransport, [{
79
+ key: "generateLogFilename",
80
+ value: function generateLogFilename() {
81
+ var timestamp = formatTimestamp();
82
+ if (timestamp === this.lastTimestamp) {
83
+ this.rotateIndex += 1;
84
+ } else {
85
+ this.rotateIndex = 0;
86
+ this.lastTimestamp = timestamp;
87
+ }
88
+ return this.rotateIndex === 0 ? "".concat(this.filenamePrefix, "-").concat(timestamp, ".log") : "".concat(this.filenamePrefix, "-").concat(timestamp, "-").concat(this.rotateIndex, ".log");
89
+ }
90
+
91
+ /**
92
+ * 创建新日志文件,并清理旧文件
93
+ */
94
+ }, {
95
+ key: "createNewLogFile",
96
+ value: function createNewLogFile() {
97
+ if (this.currentStream) {
98
+ this.currentStream.end();
99
+ }
100
+ var filename = this.generateLogFilename();
101
+ this.currentFile = this.path.join(this.logFolderPath, filename);
102
+ console.log("[CustomRotateTransport] Creating new log file: ".concat(this.currentFile));
103
+ this.currentStream = this.fs.createWriteStream(this.currentFile, {
104
+ flags: 'a'
105
+ });
106
+ this.currentSize = this.fs.existsSync(this.currentFile) ? this.fs.statSync(this.currentFile).size : 0;
107
+ this.cleanupOldFiles();
108
+ }
109
+
110
+ /**
111
+ * 只允许每个 buffer 触发一次轮转,避免多余文件
112
+ */
113
+ }, {
114
+ key: "processQueue",
115
+ value: function processQueue() {
116
+ var _this2 = this;
117
+ if (this.writing || this.writeQueue.length === 0) return;
118
+ this.writing = true;
119
+ var _ref = this.writeQueue.shift(),
120
+ buffer = _ref.buffer,
121
+ callback = _ref.callback;
122
+
123
+ // 1. 单条日志大于 maxSize,直接新建新文件并写入,不要理会 currentStream
124
+ if (buffer.length > this.maxSize) {
125
+ this.createNewLogFile();
126
+ console.log("[CustomRotateTransport] buffer.length (".concat(buffer.length, ") > maxSize (").concat(this.maxSize, "), force rotate."));
127
+ this.currentStream.write(buffer, function () {
128
+ try {
129
+ _this2.currentSize = _this2.fs.statSync(_this2.currentFile).size;
130
+ } catch (_unused) {
131
+ _this2.currentSize += buffer.length;
132
+ }
133
+ callback();
134
+ _this2.writing = false;
135
+ _this2.processQueue();
136
+ });
137
+ return;
138
+ }
139
+
140
+ // 2. buffer.length <= maxSize,才需要判断 currentStream 是否为空
141
+ if (!this.currentStream) {
142
+ this.createNewLogFile();
143
+ }
144
+ var actualSize = 0;
145
+ try {
146
+ actualSize = this.fs.existsSync(this.currentFile) ? this.fs.statSync(this.currentFile).size : 0;
147
+ } catch (_unused2) {
148
+ actualSize = this.currentSize;
149
+ }
150
+ if (actualSize + buffer.length > this.maxSize) {
151
+ console.log("[CustomRotateTransport] actualSize (".concat(actualSize, ") + buffer.length (").concat(buffer.length, ") > maxSize (").concat(this.maxSize, "), rotate."));
152
+ this.createNewLogFile();
153
+ // 强制清理,确保文件数量不超过限制
154
+ setImmediate(function () {
155
+ return _this2.cleanupOldFiles();
156
+ });
157
+ }
158
+ this.currentStream.write(buffer, function () {
159
+ try {
160
+ _this2.currentSize = _this2.fs.statSync(_this2.currentFile).size;
161
+ } catch (_unused3) {
162
+ _this2.currentSize += buffer.length;
163
+ }
164
+ callback();
165
+ _this2.writing = false;
166
+ _this2.processQueue();
167
+ });
168
+ }
169
+
170
+ /**
171
+ * 清理旧日志文件,只保留 maxFiles 个
172
+ */
173
+ }, {
174
+ key: "cleanupOldFiles",
175
+ value: function cleanupOldFiles() {
176
+ var _this3 = this;
177
+ try {
178
+ var files = this.fs.readdirSync(this.logFolderPath).filter(function (file) {
179
+ return file.startsWith(_this3.filenamePrefix) && file.endsWith('.log');
180
+ }).map(function (file) {
181
+ return {
182
+ name: file,
183
+ path: _this3.path.join(_this3.logFolderPath, file),
184
+ stat: _this3.fs.statSync(_this3.path.join(_this3.logFolderPath, file))
185
+ };
186
+ }).sort(function (a, b) {
187
+ return b.stat.mtime.getTime() - a.stat.mtime.getTime();
188
+ });
189
+ console.log("[CustomRotateTransport] Found ".concat(files.length, " log files, maxFiles: ").concat(this.maxFiles));
190
+ if (files.length > this.maxFiles) {
191
+ var filesToDelete = files.slice(this.maxFiles);
192
+ console.log("[CustomRotateTransport] Will delete ".concat(filesToDelete.length, " old files"));
193
+ filesToDelete.forEach(function (file) {
194
+ try {
195
+ _this3.fs.unlinkSync(file.path);
196
+ console.log("[CustomRotateTransport] Deleted old log file: ".concat(file.path));
197
+ } catch (err) {
198
+ console.warn("[CustomRotateTransport] Failed to delete log file: ".concat(file.path), err);
199
+ }
200
+ });
201
+ }
202
+ } catch (err) {
203
+ console.warn('[CustomRotateTransport] Error cleaning up old log files:', err);
204
+ }
205
+ }
206
+ }, {
207
+ key: "log",
208
+ value: function log(info, callback) {
209
+ var _this4 = this;
210
+ setImmediate(function () {
211
+ return _this4.emit('logged', info);
212
+ });
213
+ var message = info[Symbol["for"]('message')] || info.message || '';
214
+ var buffer = Buffer.from(message + '\n', 'utf8');
215
+ this.writeQueue.push({
216
+ buffer: buffer,
217
+ callback: callback
218
+ });
219
+ this.processQueue();
220
+ }
221
+ }, {
222
+ key: "close",
223
+ value: function close() {
224
+ if (this.currentStream) {
225
+ this.currentStream.end();
226
+ this.currentStream = null;
227
+ }
228
+ }
229
+ }]);
230
+ }(WinstonTransport);
231
+ return new CustomRotateTransport({
232
+ filenamePrefix: filenamePrefix,
233
+ logFolderPath: logFolderPath,
234
+ maxSize: options.maxSize,
235
+ maxFiles: options.maxFiles,
236
+ level: options.level
237
+ });
238
+ };
@@ -10,6 +10,6 @@ export declare const writeLog: (self: WorkerContext, callId: number, log: Log) =
10
10
  export declare const collectLogs: (self: WorkerContext, callId: number, labels: string[]) => Promise<void>;
11
11
  export declare const deleteLogs: (self: WorkerContext, callId: number, labels: string[], lastId: number) => Promise<void>;
12
12
  export declare const setMaxRecords: (self: WorkerContext, callId: number, max: number) => void;
13
- export declare const addFsLogger: (self: WorkerContext, callId: number, label: string, logFolderPath: string) => void;
13
+ export declare const addFsLogger: (self: WorkerContext, callId: number, label: string, logFolderPath: string, maxFiles: number) => void;
14
14
  export declare const writeLogsToDisk: (logs: LogSchema[]) => void;
15
15
  export {};
@@ -40,10 +40,10 @@ var _reply = require("./reply");
40
40
  var _raceCondition = require("../../utilities/race-condition");
41
41
  var _jszip = _interopRequireDefault(require("jszip"));
42
42
  var _env = require("../../utilities/env");
43
- var _logRotate = require("./log-rotate");
43
+ var _logRotateNew = require("./log-rotate-new");
44
44
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
45
45
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
46
- function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
46
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } // import { createRotateTransport } from './log-rotate';
47
47
  var MAX_WAIT_TIME = 3000;
48
48
  var mutex = new _mutex.Mutex();
49
49
  var maxRecords = 50000;
@@ -259,7 +259,7 @@ var setMaxRecords = exports.setMaxRecords = function setMaxRecords(self, callId,
259
259
  isSuccess: true
260
260
  });
261
261
  };
262
- var addFsLogger = exports.addFsLogger = function addFsLogger(self, callId, label, logFolderPath) {
262
+ var addFsLogger = exports.addFsLogger = function addFsLogger(self, callId, label, logFolderPath, maxFiles) {
263
263
  var winston = require('winston');
264
264
  if (!winston.loggers.has(label)) {
265
265
  console.log("[worker] add fs logger, label: ".concat(label));
@@ -268,13 +268,9 @@ var addFsLogger = exports.addFsLogger = function addFsLogger(self, callId, label
268
268
  var message = _ref4.message;
269
269
  return "".concat(message);
270
270
  }),
271
- transports: [
272
- // new winston.transports.File({
273
- // filename: logPath,
274
- // maxFiles: 3,
275
- // maxsize: 1048576, //1MB,
276
- // }),
277
- (0, _logRotate.createRotateTransport)("apaas-".concat(label), logFolderPath)]
271
+ transports: [(0, _logRotateNew.createRotateTransport)("".concat(label), logFolderPath, {
272
+ maxFiles: maxFiles
273
+ })]
278
274
  });
279
275
  }
280
276
  (0, _reply.reply)(self, callId, _constants.WorkerDirectives.ADD_FS_LOGGER, {
@@ -3,7 +3,7 @@ export declare class WorkerInteractor implements LogWorkerInteractor {
3
3
  private _eventEmitter;
4
4
  private _logWorker;
5
5
  constructor();
6
- addFsLogger(label: string, logFolderPath: string): Promise<void>;
6
+ addFsLogger(label: string, logFolderPath: string, maxFiles: number): Promise<void>;
7
7
  clearTempLogs(): Promise<void>;
8
8
  setMaxRecords(maxRecords: number): Promise<void>;
9
9
  sendLog(message: string, label: string): void;
@@ -10,10 +10,51 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
10
10
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
11
  require("core-js/modules/es.error.cause.js");
12
12
  require("core-js/modules/es.error.to-string.js");
13
+ require("core-js/modules/es.array.iterator.js");
14
+ require("core-js/modules/es.array-buffer.constructor.js");
15
+ require("core-js/modules/es.array-buffer.slice.js");
16
+ require("core-js/modules/es.data-view.js");
13
17
  require("core-js/modules/es.date.now.js");
14
18
  require("core-js/modules/es.function.bind.js");
15
19
  require("core-js/modules/es.object.to-string.js");
16
20
  require("core-js/modules/es.promise.js");
21
+ require("core-js/modules/es.typed-array.uint8-array.js");
22
+ require("core-js/modules/es.typed-array.at.js");
23
+ require("core-js/modules/es.typed-array.copy-within.js");
24
+ require("core-js/modules/es.typed-array.every.js");
25
+ require("core-js/modules/es.typed-array.fill.js");
26
+ require("core-js/modules/es.typed-array.filter.js");
27
+ require("core-js/modules/es.typed-array.find.js");
28
+ require("core-js/modules/es.typed-array.find-index.js");
29
+ require("core-js/modules/es.typed-array.find-last.js");
30
+ require("core-js/modules/es.typed-array.find-last-index.js");
31
+ require("core-js/modules/es.typed-array.for-each.js");
32
+ require("core-js/modules/es.typed-array.includes.js");
33
+ require("core-js/modules/es.typed-array.index-of.js");
34
+ require("core-js/modules/es.typed-array.iterator.js");
35
+ require("core-js/modules/es.typed-array.join.js");
36
+ require("core-js/modules/es.typed-array.last-index-of.js");
37
+ require("core-js/modules/es.typed-array.map.js");
38
+ require("core-js/modules/es.typed-array.reduce.js");
39
+ require("core-js/modules/es.typed-array.reduce-right.js");
40
+ require("core-js/modules/es.typed-array.reverse.js");
41
+ require("core-js/modules/es.typed-array.set.js");
42
+ require("core-js/modules/es.typed-array.slice.js");
43
+ require("core-js/modules/es.typed-array.some.js");
44
+ require("core-js/modules/es.typed-array.sort.js");
45
+ require("core-js/modules/es.typed-array.subarray.js");
46
+ require("core-js/modules/es.typed-array.to-locale-string.js");
47
+ require("core-js/modules/es.typed-array.to-reversed.js");
48
+ require("core-js/modules/es.typed-array.to-sorted.js");
49
+ require("core-js/modules/es.typed-array.to-string.js");
50
+ require("core-js/modules/es.typed-array.with.js");
51
+ require("core-js/modules/esnext.array-buffer.detached.js");
52
+ require("core-js/modules/esnext.array-buffer.transfer.js");
53
+ require("core-js/modules/esnext.array-buffer.transfer-to-fixed-length.js");
54
+ require("core-js/modules/esnext.typed-array.filter-reject.js");
55
+ require("core-js/modules/esnext.typed-array.group-by.js");
56
+ require("core-js/modules/esnext.typed-array.to-spliced.js");
57
+ require("core-js/modules/esnext.typed-array.unique-by.js");
17
58
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
18
59
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
19
60
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
@@ -38,14 +79,15 @@ var WorkerInteractor = exports.WorkerInteractor = /*#__PURE__*/function () {
38
79
  }
39
80
  return (0, _createClass2["default"])(WorkerInteractor, [{
40
81
  key: "addFsLogger",
41
- value: function addFsLogger(label, logFolderPath) {
82
+ value: function addFsLogger(label, logFolderPath, maxFiles) {
42
83
  try {
43
84
  console.info("[WorkerInteractor] add fs logger, label: ".concat(label));
44
85
  return this._promisify({
45
86
  type: _constants.WorkerDirectives.ADD_FS_LOGGER,
46
87
  data: {
47
88
  label: label,
48
- logFolderPath: logFolderPath
89
+ logFolderPath: logFolderPath,
90
+ maxFiles: maxFiles
49
91
  }
50
92
  });
51
93
  } catch (err) {
@@ -158,7 +200,7 @@ var WorkerInteractor = exports.WorkerInteractor = /*#__PURE__*/function () {
158
200
  buffer = _yield$this$_promisif.buffer;
159
201
  lastId = _yield$this$_promisif.lastId;
160
202
  datefmt = (0, _dayjs["default"])().format('YYYY-MM-DDTHH:mm:ssZ[Z]');
161
- file = new File([buffer], "logs-".concat(datefmt, ".zip"), {
203
+ file = new File([new Uint8Array(buffer)], "logs-".concat(datefmt, ".zip"), {
162
204
  type: 'application/zip'
163
205
  });
164
206
  return _context2.abrupt("return", {
@@ -309,7 +351,7 @@ var WorkerInteractor = exports.WorkerInteractor = /*#__PURE__*/function () {
309
351
  _yield$this$_promisif3 = _context4.sent;
310
352
  buffer = _yield$this$_promisif3.buffer;
311
353
  datefmt = (0, _dayjs["default"])().format('YYYY-MM-DDTHH:mm:ssZ[Z]');
312
- file = new File([buffer], "logs-".concat(datefmt, ".zip"), {
354
+ file = new File([new Uint8Array(buffer)], "logs-".concat(datefmt, ".zip"), {
313
355
  type: 'application/zip'
314
356
  });
315
357
  return _context4.abrupt("return", file);