@serverless-guru/logger
Advanced tools
Comparing version 1.0.6 to 1.0.7
@@ -1,2 +0,2 @@ | ||
import { MetricUnitList } from "./constants"; | ||
import { MetricUnitList } from "./constants.js"; | ||
import type { Level, StringArray, MetricMeta, JSONObject } from "./types"; | ||
@@ -3,0 +3,0 @@ declare class Logger { |
@@ -7,7 +7,7 @@ "use strict"; | ||
const node_console_1 = require("node:console"); | ||
const constants_1 = require("./constants"); | ||
const constants_js_1 = require("./constants.js"); | ||
const NO_LOG_EVENT = process.env.SG_LOGGER_LOG_EVENT?.toLowerCase() === "false"; | ||
const SKIP_MASK = process.env.SG_LOGGER_MASK?.toLowerCase() === "false"; | ||
const MAX_SIZE = parseInt(process.env.SG_LOGGER_MAX_SIZE || `${constants_1.MAX_PAYLOAD_SIZE}`) || constants_1.MAX_PAYLOAD_SIZE; | ||
const COMPRESS_SIZE = parseInt(process.env.SG_LOGGER_COMPRESS_SIZE || `${constants_1.COMPRESS_PAYLOAD_SIZE}`) || constants_1.COMPRESS_PAYLOAD_SIZE; | ||
const MAX_SIZE = parseInt(process.env.SG_LOGGER_MAX_SIZE || `${constants_js_1.MAX_PAYLOAD_SIZE}`) || constants_js_1.MAX_PAYLOAD_SIZE; | ||
const COMPRESS_SIZE = parseInt(process.env.SG_LOGGER_COMPRESS_SIZE || `${constants_js_1.COMPRESS_PAYLOAD_SIZE}`) || constants_js_1.COMPRESS_PAYLOAD_SIZE; | ||
const NO_COMPRESS = process.env.SG_LOGGER_NO_COMPRESS?.toLowerCase() === "true"; | ||
@@ -17,3 +17,3 @@ const NO_SKIP = process.env.SG_LOGGER_NO_SKIP?.toLowerCase() === "true"; | ||
class Logger { | ||
static METRIC_UNITS = constants_1.MetricUnitList; | ||
static METRIC_UNITS = constants_js_1.MetricUnitList; | ||
serviceName; | ||
@@ -97,3 +97,3 @@ correlationId; | ||
} | ||
if (level === "warn" && message === constants_1.MAX_PAYLOAD_MESSAGE) { | ||
if (level === "warn" && message === constants_js_1.MAX_PAYLOAD_MESSAGE) { | ||
return { gzip: false, payload }; | ||
@@ -103,3 +103,3 @@ } | ||
if (stringifiedPayload?.length > MAX_SIZE && !NO_SKIP) { | ||
this.warn(constants_1.MAX_PAYLOAD_MESSAGE, { size: stringifiedPayload.length, MAX_SIZE }); | ||
this.warn(constants_js_1.MAX_PAYLOAD_MESSAGE, { size: stringifiedPayload.length, MAX_SIZE }); | ||
return { gzip: false, payload: undefined }; | ||
@@ -227,3 +227,3 @@ } | ||
} | ||
const unit = meta.name === "Duration" ? constants_1.MetricUnitList.Milliseconds : meta.unit || constants_1.MetricUnitList.Count; | ||
const unit = meta.name === "Duration" ? constants_js_1.MetricUnitList.Milliseconds : meta.unit || constants_js_1.MetricUnitList.Count; | ||
const dimensions = meta.dimensions || []; | ||
@@ -230,0 +230,0 @@ const emf = { |
@@ -1,2 +0,2 @@ | ||
import { MetricUnitList } from "./constants"; | ||
import { MetricUnitList } from "./constants.js"; | ||
import type { Level, StringArray, MetricMeta, JSONObject } from "./types"; | ||
@@ -3,0 +3,0 @@ declare class Logger { |
import { randomUUID } from "node:crypto"; | ||
import { gzipSync } from "node:zlib"; | ||
import { Console } from "node:console"; | ||
import { MetricUnitList, MAX_PAYLOAD_SIZE, COMPRESS_PAYLOAD_SIZE, MAX_PAYLOAD_MESSAGE } from "./constants"; | ||
import { MetricUnitList, MAX_PAYLOAD_SIZE, COMPRESS_PAYLOAD_SIZE, MAX_PAYLOAD_MESSAGE } from "./constants.js"; | ||
const NO_LOG_EVENT = process.env.SG_LOGGER_LOG_EVENT?.toLowerCase() === "false"; | ||
@@ -6,0 +6,0 @@ const SKIP_MASK = process.env.SG_LOGGER_MASK?.toLowerCase() === "false"; |
{ | ||
"name": "@serverless-guru/logger", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "Common logger utility", | ||
@@ -48,15 +48,15 @@ "main": "./lib/cjs/index.js", | ||
"@types/jest": "29.5.14", | ||
"@types/node": "22.7.4", | ||
"@typescript-eslint/eslint-plugin": "8.8.0", | ||
"@typescript-eslint/parser": "8.8.0", | ||
"eslint": "9.11.1", | ||
"@types/node": "22.10.2", | ||
"@typescript-eslint/eslint-plugin": "8.18.1", | ||
"@typescript-eslint/parser": "8.18.1", | ||
"eslint": "9.17.0", | ||
"eslint-config-prettier": "9.1.0", | ||
"eslint-plugin-jest": "28.8.3", | ||
"eslint-plugin-jsdoc": "50.3.0", | ||
"eslint-plugin-n": "17.10.3", | ||
"eslint-plugin-promise": "7.1.0", | ||
"eslint-plugin-jest": "28.9.0", | ||
"eslint-plugin-jsdoc": "50.6.1", | ||
"eslint-plugin-n": "17.15.0", | ||
"eslint-plugin-promise": "7.2.1", | ||
"jest": "29.7.0", | ||
"prettier": "3.3.3", | ||
"prettier": "3.4.2", | ||
"ts-jest": "29.2.5", | ||
"typescript": "5.6.2" | ||
"typescript": "5.7.2" | ||
}, | ||
@@ -63,0 +63,0 @@ "author": "Serverless Guru", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
55605