@seidor-cloud-produtos/orbit-backend-lib 2.0.53 → 2.0.57

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.
@@ -31,10 +31,10 @@ export interface Logger {
31
31
  debug: (...input: any[]) => Promise<void> | void;
32
32
  }
33
33
  export default abstract class LoggerGateway implements Logger {
34
- protected cache: Cache;
34
+ protected cache?: Cache | undefined;
35
35
  protected options?: LogOptions | undefined;
36
36
  protected params?: LogParams | undefined;
37
- constructor(cache: Cache, options?: LogOptions | undefined, params?: LogParams | undefined);
37
+ constructor(cache?: Cache | undefined, options?: LogOptions | undefined, params?: LogParams | undefined);
38
38
  private static cacheKey;
39
39
  info(...input: any[]): Promise<void>;
40
40
  warn(...input: any[]): Promise<void>;
@@ -67,7 +67,7 @@ class LoggerGateway {
67
67
  return acceptValues;
68
68
  }
69
69
  async isToLog(props, dataToLog) {
70
- if (props.level === types_1.LOG_LEVEL.error) {
70
+ if (props.level === types_1.LOG_LEVEL.error || !this.cache) {
71
71
  return true;
72
72
  }
73
73
  if (!dataToLog.length) {
@@ -113,6 +113,9 @@ class LoggerGateway {
113
113
  };
114
114
  }
115
115
  async setLevel(level, filter, ttl) {
116
+ if (!this.cache) {
117
+ return;
118
+ }
116
119
  const fourDaysInSeconds = 345600;
117
120
  return await this.cache.set(`${LoggerGateway.cacheKey}:${filter.logType}:${filter.logActor}`, level, ttl || fourDaysInSeconds);
118
121
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seidor-cloud-produtos/orbit-backend-lib",
3
- "version": "2.0.53",
3
+ "version": "2.0.57",
4
4
  "description": "Internal lib for backend components",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",