exodus-framework 2.1.1007 → 2.1.1008

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.
@@ -2,17 +2,17 @@ import { Logger } from 'pino';
2
2
  import Managed from '../app/classes/managed';
3
3
  declare class LoggerService extends Managed {
4
4
  private static loggerInstance;
5
- private path;
5
+ private static path;
6
6
  onInit(): Promise<void>;
7
7
  onMasterInit(): Promise<void>;
8
8
  private createLogger;
9
- reservedFileLog(title: string, filename: string, ...args: any[]): Promise<void>;
9
+ static reservedFileLog(title: string, filename: string, ...args: any[]): Promise<void>;
10
10
  static logger(): Logger<never>;
11
11
  private compressLogFolder;
12
12
  private backupLogs;
13
13
  private cleanBackupLogs;
14
- private toObject;
15
- private writeToLog;
14
+ private static toObject;
15
+ private static writeToLog;
16
16
  }
17
17
  export default LoggerService;
18
18
  //# sourceMappingURL=logger.d.ts.map
@@ -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;IAC7C,OAAO,CAAC,IAAI,CAAS;IAER,MAAM;IAON,YAAY;YAOX,YAAY;IA2Db,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE;WAO9D,MAAM;YAIN,iBAAiB;YA2BjB,UAAU;YA2BV,eAAe;IAyB7B,OAAO,CAAC,QAAQ;IAIhB,OAAO,CAAC,UAAU;CAOnB;AACD,eAAe,aAAa,CAAC"}
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;IAC7C,OAAO,CAAC,MAAM,CAAC,IAAI,CAAS;IAEf,MAAM;IAON,YAAY;YAOX,YAAY;WA2DN,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE;WAOrE,MAAM;YAIN,iBAAiB;YA2BjB,UAAU;YA2BV,eAAe;IAyB7B,OAAO,CAAC,MAAM,CAAC,QAAQ;IAIvB,OAAO,CAAC,MAAM,CAAC,UAAU;CAO1B;AACD,eAAe,aAAa,CAAC"}
@@ -18,7 +18,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
18
18
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
19
19
  class LoggerService extends _managed.default {
20
20
  static loggerInstance;
21
- path;
21
+ static path;
22
22
  async onInit() {
23
23
  super.onInit();
24
24
  if (!LoggerService.loggerInstance) {
@@ -34,8 +34,8 @@ class LoggerService extends _managed.default {
34
34
  await this.cleanBackupLogs();
35
35
  }
36
36
  async createLogger() {
37
- this.path = _path.default.resolve(_core.default.settings.getLogger().path, (0, _dateFns.format)(_exodus.default.getStartedAt(), 'dd-MM-yyyy'), (0, _dateFns.format)(_exodus.default.getStartedAt(), 'HH_mm'));
38
- await (0, _promises.mkdir)(this.path, {
37
+ LoggerService.path = _path.default.resolve(_core.default.settings.getLogger().path, (0, _dateFns.format)(_exodus.default.getStartedAt(), 'dd-MM-yyyy'), (0, _dateFns.format)(_exodus.default.getStartedAt(), 'HH_mm'));
38
+ await (0, _promises.mkdir)(LoggerService.path, {
39
39
  recursive: true
40
40
  });
41
41
  const isDev = process.argv.includes('--dev');
@@ -43,42 +43,42 @@ class LoggerService extends _managed.default {
43
43
  level: 'info',
44
44
  target: '../utils/logger-transport' + (isDev ? '.ts' : '.js'),
45
45
  options: {
46
- destination: _path.default.join(this.path, 'info.json'),
46
+ destination: _path.default.join(LoggerService.path, 'info.json'),
47
47
  level: 'info'
48
48
  }
49
49
  }, {
50
50
  level: 'error',
51
51
  target: '../utils/logger-transport' + (isDev ? '.ts' : '.js'),
52
52
  options: {
53
- destination: _path.default.join(this.path, 'error.json'),
53
+ destination: _path.default.join(LoggerService.path, 'error.json'),
54
54
  level: 'error'
55
55
  }
56
56
  }, {
57
57
  level: 'debug',
58
58
  target: '../utils/logger-transport' + (isDev ? '.ts' : '.js'),
59
59
  options: {
60
- destination: _path.default.join(this.path, 'debug.json'),
60
+ destination: _path.default.join(LoggerService.path, 'debug.json'),
61
61
  level: 'debug'
62
62
  }
63
63
  }, {
64
64
  level: 'warn',
65
65
  target: '../utils/logger-transport' + (isDev ? '.ts' : '.js'),
66
66
  options: {
67
- destination: _path.default.join(this.path, 'warn.json'),
67
+ destination: _path.default.join(LoggerService.path, 'warn.json'),
68
68
  level: 'warn'
69
69
  }
70
70
  }, {
71
71
  level: 'fatal',
72
72
  target: '../utils/logger-transport' + (isDev ? '.ts' : '.js'),
73
73
  options: {
74
- destination: _path.default.join(this.path, 'fatal.json'),
74
+ destination: _path.default.join(LoggerService.path, 'fatal.json'),
75
75
  level: 'fatal'
76
76
  }
77
77
  }, {
78
78
  level: 'trace',
79
79
  target: '../utils/logger-transport' + (isDev ? '.ts' : '.js'),
80
80
  options: {
81
- destination: _path.default.join(this.path, 'trace.json'),
81
+ destination: _path.default.join(LoggerService.path, 'trace.json'),
82
82
  level: 'trace'
83
83
  }
84
84
  }];
@@ -99,10 +99,10 @@ class LoggerService extends _managed.default {
99
99
  targets
100
100
  }));
101
101
  }
102
- async reservedFileLog(title, filename, ...args) {
102
+ static async reservedFileLog(title, filename, ...args) {
103
103
  if (args.length < 1) return;
104
- const obj = this.toObject(args);
105
- this.writeToLog(filename, title, JSON.stringify(obj, null, 2));
104
+ const obj = LoggerService.toObject(args);
105
+ LoggerService.writeToLog(filename, title, JSON.stringify(obj, null, 2));
106
106
  }
107
107
  static logger() {
108
108
  return LoggerService.loggerInstance;
@@ -180,14 +180,14 @@ class LoggerService extends _managed.default {
180
180
  }
181
181
  this.log(`🗑️ Limpeza de ${count} backups concluída`, 'success');
182
182
  }
183
- toObject(data) {
183
+ static toObject(data) {
184
184
  return JSON.parse(JSON.stringify(data, null, 2));
185
185
  }
186
- writeToLog(filename, message, data) {
186
+ static writeToLog(filename, message, data) {
187
187
  const date = new Date();
188
188
  const logMessage = `[${(0, _dateFns.format)(date, 'HH:mm:ss')}][${message}]: ${data}\n`;
189
- console.log('salvando', `${this.path}/${filename}.log`);
190
- fs.appendFileSync(`${this.path}/${filename}.log`, logMessage);
189
+ console.log('salvando', `${LoggerService.path}/${filename}.log`);
190
+ fs.appendFileSync(`${LoggerService.path}/${filename}.log`, logMessage);
191
191
  }
192
192
  }
193
193
  var _default = exports.default = LoggerService;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "exodus-framework",
3
- "version": "2.1.1007",
3
+ "version": "2.1.1008",
4
4
  "description": "Exodus Framework",
5
5
  "author": "jhownpaixao",
6
6
  "license": "ISC",