@byelabel/utils
Advanced tools
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/utils/log.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,YAAY,GAAG,OAAO,CAAC;AAE3F,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,UAAoB,GAAG;IACrE,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAA;CACjB,CAsBA;AAED,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,OAAe,GAAG,OAAO,CAAC,MAAM,CAAC,CAU/E;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,OAAe,GAAG,OAAO,CAAC,MAAM,CAAC,CAUlF;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,GAAG,EAAE,IAAI,GAAE,OAAe,GAAG,OAAO,CAAC,MAAM,CAAC,CA2EvG;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,CAYrD"} | ||
| {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/utils/log.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,YAAY,GAAG,OAAO,CAAC;AAQ3F,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,UAAoB,GAAG;IACrE,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAA;CACjB,CAsBA;AAED,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,OAAe,GAAG,OAAO,CAAC,MAAM,CAAC,CAU/E;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,OAAe,GAAG,OAAO,CAAC,MAAM,CAAC,CAUlF;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,GAAG,EAAE,IAAI,GAAE,OAAe,GAAG,OAAO,CAAC,MAAM,CAAC,CA2EvG;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,CAYrD"} |
@@ -27,2 +27,7 @@ "use strict"; | ||
| const validator_1 = require("./validator"); | ||
| function timestamp() { | ||
| const now = new Date(); | ||
| const pad = (n, width = 2) => String(n).padStart(width, '0'); | ||
| return `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())} ${pad(now.getHours())}:${pad(now.getMinutes())}:${pad(now.getSeconds())}.${pad(now.getMilliseconds(), 3)}`; | ||
| } | ||
| function writeToFile(data, type = 'error') { | ||
@@ -48,3 +53,3 @@ const path = (0, node_path_1.join)(node_process_1.default.env.ROOT_PATH, (node_process_1.default.env.LOGS_PATH || 'logs')); | ||
| if ((node_process_1.default.env.DEBUG === 'true') || show) { | ||
| console.log(message); | ||
| console.log(`${timestamp()} - ${message}`); | ||
| } | ||
@@ -58,3 +63,3 @@ resolve(message); | ||
| if ((node_process_1.default.env.DEBUG === 'true') || show) { | ||
| console.log(message); | ||
| console.log(`${timestamp()} - ${message}`); | ||
| } | ||
@@ -73,3 +78,3 @@ resolve(message); | ||
| if ((node_process_1.default.env.DEBUG === 'true') || show) { | ||
| console.log(errorString); | ||
| console.log(`${timestamp()} - ${errorString}`); | ||
| } | ||
@@ -125,3 +130,3 @@ return resolve(`App Error: ${errorString}`); | ||
| if ((node_process_1.default.env.DEBUG === 'true') || show) { | ||
| console.log(errorString); | ||
| console.log(`${timestamp()} - ${errorString}`); | ||
| } | ||
@@ -128,0 +133,0 @@ resolve(errorString); |
+1
-1
| { | ||
| "name": "@byelabel/utils", | ||
| "version": "2.1.5", | ||
| "version": "2.1.6", | ||
| "description": "ByeLabel Utilities", | ||
@@ -5,0 +5,0 @@ "type": "commonjs", |
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 3 instances in 1 package
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 3 instances in 1 package
184552
0.22%3072
0.16%