@63klabs/cache-data 1.3.2 → 1.3.3

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/CHANGELOG.md CHANGED
@@ -8,15 +8,16 @@ Report all vulnerabilities under the [Security menu](https://github.com/63Klabs/
8
8
 
9
9
  > Note: This project is still in beta. Even though changes are tested and breaking changes are avoided, things may break.
10
10
 
11
- ## 1.3.2 (2025-09-12)
11
+ ## 1.3.3 (2025-09-14)
12
12
 
13
13
  ### Enhancements
14
14
 
15
- - `DebugAndLog`: The environment variable `AWS_LAMBDA_LOG_LEVEL` is now checked as well for setting logging level. `LOG_LEVEL` has priority.
15
+ - `DebugAndLog`: The environment variable `AWS_LAMBDA_LOG_LEVEL` is now checked as well for setting logging level. `LOG_LEVEL` has priority. (v1.3.2)
16
+ - `DebugAndLog`: The log level environment variable now accepts strings as well as numbers `ERROR`, `WARN`, `INFO`, `MSG`, `DIAG`, `DEBUG` or `0`, `1`, `2`, `3`, `4`, `5` respectively.
16
17
 
17
18
  ### Fixes
18
19
 
19
- - `DebugAndLog`: Environment and Logging Level value checks are fixed
20
+ - `DebugAndLog`: Environment and Logging Level value checks are fixed (v1.3.2)
20
21
 
21
22
  ## 1.3.0 (2025-07-16)
22
23
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@63klabs/cache-data",
3
- "version": "1.3.2",
3
+ "version": "1.3.3",
4
4
  "description": "Cache data from an API endpoint or application process using AWS S3 and DynamoDb",
5
5
  "author": "Chad Leigh Kluck (https://chadkluck.me)",
6
6
  "license": "MIT",
@@ -178,7 +178,7 @@ const _httpGetExecute = async function (options, requestObject, xRaySegment = xR
178
178
  }
179
179
  };
180
180
 
181
- DebugAndLog.debug(`Response status ${res.statusCode}`, {status: res.statusCode, headers: res.headers});
181
+ DebugAndLog.debug(`Response status ${res.statusCode}`, {status: res.statusCode, method: requestObject.getMethod(), host: requestObject.getHost(), url: requestObject.getURI(false), headers: res.headers});
182
182
 
183
183
  if (res.statusCode >= 500) {
184
184
  xRaySegment.addFaultFlag();
@@ -585,8 +585,6 @@ class APIRequest {
585
585
 
586
586
  const result = await _httpGetExecute(options, this, subsegment);
587
587
 
588
- console.log("RESULT", result);
589
-
590
588
  subsegment.addAnnotation('success', result ? "true" : "false");
591
589
  subsegment.addAnnotation('status_code', this.#response?.statusCode || 500);
592
590
  subsegment.addAnnotation('note', this.getNote());
@@ -35,6 +35,8 @@ class DebugAndLog {
35
35
  static DIAG = "DIAG";
36
36
  static DEBUG = "DEBUG";
37
37
 
38
+ static ALLOWED_LOG_LEVEL_STRINGS = ["ERROR", "WARN", "INFO", "MSG", "DIAG", "DEBUG"];
39
+
38
40
  static LOG_LEVEL_NUM = 0;
39
41
  static ERROR_LEVEL_NUM = 0;
40
42
  static WARN_LEVEL_NUM = 1;
@@ -205,10 +207,20 @@ class DebugAndLog {
205
207
  logLevel = DebugAndLog.ERROR_LEVEL_NUM;
206
208
  found = true;
207
209
  break;
210
+ case "CRITICAL":
211
+ logLevel = DebugAndLog.ERROR_LEVEL_NUM; // This is lowest we go and will let Lambda filter out
212
+ found = true;
213
+ break;
214
+ case "SILENT":
215
+ logLevel = DebugAndLog.ERROR_LEVEL_NUM; // This is lowest we go and will let Lambda filter out
216
+ found = true;
217
+ break;
208
218
  default: // invalid
209
219
  break;
210
220
  }
211
-
221
+ } else if (typeof process.env[lev] === "string" && DebugAndLog.ALLOWED_LOG_LEVEL_STRINGS.includes(process.env[lev].toUpperCase())) {
222
+ logLevel = DebugAndLog[process.env[lev].toUpperCase().concat("_LEVEL_NUM")];
223
+ found = true;
212
224
  } else if (Number.isFinite(Number(process.env[lev]))) {
213
225
  logLevel = Number(process.env[lev]);
214
226
  found = true;