exodus-framework 2.0.9983 → 2.0.9985
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.
package/lib/app/error.js
CHANGED
@@ -25,7 +25,7 @@ class ErrorHandler extends _managed.default {
|
|
25
25
|
register() {
|
26
26
|
const message = this.caller && this.caller != 'L' ? `[${this.caller}]->${this.message}` : this.message;
|
27
27
|
this.log(`${message}`, 'danger');
|
28
|
-
|
28
|
+
_logger.default.logger().error(this.error, this.message);
|
29
29
|
}
|
30
30
|
getCallerClassName() {
|
31
31
|
const err = new Error();
|
package/lib/contracts/log.d.ts
CHANGED
@@ -1,4 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
export type DBLogData = {
|
2
|
+
category: string;
|
3
|
+
origin: string;
|
4
|
+
action: string;
|
5
|
+
comments?: string;
|
6
|
+
data?: Record<string, any>;
|
7
|
+
params?: Record<string, any>;
|
8
|
+
};
|
4
9
|
//# sourceMappingURL=log.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/contracts/log.ts"],"names":[],"mappings":"AAAA,
|
1
|
+
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/contracts/log.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC9B,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/services/logger.ts"],"names":[],"mappings":"AAEA,OAAa,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,OAAO,MAAM,wBAAwB,CAAC;AAQ7C,cAAM,aAAc,SAAQ,OAAO;IACjC,OAAO,CAAC,MAAM,CAAC,cAAc,CAAgB;IAEhC,MAAM;IAON,YAAY;YAOX,YAAY;WA2DZ,MAAM;YAIN,iBAAiB;YA2BjB,UAAU;
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/services/logger.ts"],"names":[],"mappings":"AAEA,OAAa,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,OAAO,MAAM,wBAAwB,CAAC;AAQ7C,cAAM,aAAc,SAAQ,OAAO;IACjC,OAAO,CAAC,MAAM,CAAC,cAAc,CAAgB;IAEhC,MAAM;IAON,YAAY;YAOX,YAAY;WA2DZ,MAAM;YAIN,iBAAiB;YA2BjB,UAAU;YA2BV,eAAe;CAwB9B;AACD,eAAe,aAAa,CAAC"}
|
package/lib/services/logger.js
CHANGED
@@ -129,6 +129,7 @@ class LoggerService extends _managed.default {
|
|
129
129
|
}
|
130
130
|
async backupLogs() {
|
131
131
|
const logs = await (0, _promises.readdir)(_core.default.settings.getLogger().path);
|
132
|
+
let count = 0;
|
132
133
|
for (const dateFolder of logs) {
|
133
134
|
const datePath = _path.default.join(_core.default.settings.getLogger().path, dateFolder);
|
134
135
|
const stats = await (0, _promises.stat)(datePath);
|
@@ -136,17 +137,24 @@ class LoggerService extends _managed.default {
|
|
136
137
|
|
137
138
|
// Ignora se não for pasta ou se for a pasta do dia
|
138
139
|
if (!isDir || dateFolder === 'backups' || dateFolder === (0, _dateFns.format)(_exodus.default.getStartedAt(), 'dd-MM-yyyy')) continue;
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
140
|
+
try {
|
141
|
+
await this.compressLogFolder(dateFolder);
|
142
|
+
this.log(`✅ ${dateFolder} → compactado`);
|
143
|
+
await (0, _promises.rm)(datePath, {
|
144
|
+
recursive: true,
|
145
|
+
force: true
|
146
|
+
});
|
147
|
+
count++;
|
148
|
+
} catch (error) {
|
149
|
+
this.log(`❌ ${dateFolder} → erro ao compactar: ${error.message}`, 'warning');
|
150
|
+
}
|
145
151
|
}
|
152
|
+
this.log(`🗂️ Backup de ${count} logs concluído`, 'success');
|
146
153
|
}
|
147
154
|
async cleanBackupLogs() {
|
148
155
|
const backupPath = _path.default.join(_core.default.settings.getLogger().path, 'backups');
|
149
156
|
const backups = await (0, _promises.readdir)(backupPath);
|
157
|
+
let count = 0;
|
150
158
|
for (const backup of backups) {
|
151
159
|
const backupFile = _path.default.join(backupPath, backup);
|
152
160
|
const stats = await (0, _promises.stat)(backupFile);
|
@@ -161,8 +169,10 @@ class LoggerService extends _managed.default {
|
|
161
169
|
force: true
|
162
170
|
});
|
163
171
|
this.log(`✅ ${backup} → removido`);
|
172
|
+
count++;
|
164
173
|
}
|
165
174
|
}
|
175
|
+
this.log(`🗑️ Limpeza de ${count} backups concluída`, 'success');
|
166
176
|
}
|
167
177
|
}
|
168
178
|
var _default = exports.default = LoggerService;
|