@applitools/logger
Advanced tools
+12
-0
| # Changelog | ||
| ## [2.2.8](https://github.com/Applitools-Dev/sdk/compare/js/logger@2.2.7...js/logger@2.2.8) (2026-02-16) | ||
| ### Bug Fixes | ||
| * use utils for environment variable retrieval in logger handlers ([#3551](https://github.com/Applitools-Dev/sdk/issues/3551)) ([caf97f3](https://github.com/Applitools-Dev/sdk/commit/caf97f34207bc3b8ee6ccda2855c27a99a262f8c)) | ||
| ### Performance Improvements | ||
| * add timing logs to classic | FLD-4137 ([#3543](https://github.com/Applitools-Dev/sdk/issues/3543)) ([de2b0aa](https://github.com/Applitools-Dev/sdk/commit/de2b0aaf08d813f2c59e9552947c2f4fbc12da48)) | ||
| ## [2.2.7](https://github.com/Applitools-Dev/sdk/compare/js/logger@2.2.6...js/logger@2.2.7) (2025-12-01) | ||
@@ -4,0 +16,0 @@ |
@@ -30,5 +30,6 @@ "use strict"; | ||
| const os = __importStar(require("os")); | ||
| const utils = __importStar(require("@applitools/utils")); | ||
| function makeFileHandler(_a) { | ||
| var _b; | ||
| var { filename = (_b = process.env.APPLITOOLS_LOG_FILE) !== null && _b !== void 0 ? _b : 'eyes.log', append = true, } = _a === void 0 ? {} : _a; | ||
| var { filename = (_b = utils.general.getEnvValue('LOG_FILE')) !== null && _b !== void 0 ? _b : 'eyes.log', append = true, } = _a === void 0 ? {} : _a; | ||
| let writer = null; | ||
@@ -35,0 +36,0 @@ return { log, open, close }; |
@@ -31,5 +31,6 @@ "use strict"; | ||
| const os = __importStar(require("os")); | ||
| const utils = __importStar(require("@applitools/utils")); | ||
| function makeRollingFileHandler(_a) { | ||
| var _b; | ||
| var { dirname = (_b = process.env.APPLITOOLS_LOG_DIR) !== null && _b !== void 0 ? _b : os.tmpdir(), name = 'rolling-log', maxFileLength = 52428800 /* 50 MB */, maxFileNumber = 4, } = _a === void 0 ? {} : _a; | ||
| var { dirname = (_b = utils.general.getEnvValue('LOG_DIR')) !== null && _b !== void 0 ? _b : os.tmpdir(), name = 'rolling-log', maxFileLength = 52428800 /* 50 MB */, maxFileNumber = 4, } = _a === void 0 ? {} : _a; | ||
| let writer = null; | ||
@@ -36,0 +37,0 @@ let fileLength = 0; |
+19
-5
@@ -51,9 +51,9 @@ "use strict"; | ||
| if (!options.handler) { | ||
| if (process.env.APPLITOOLS_LOG_FILE) { | ||
| options.handler = { type: 'file', filename: process.env.APPLITOOLS_LOG_FILE }; | ||
| if (utils.general.getEnvValue('LOG_FILE')) { | ||
| options.handler = { type: 'file', filename: utils.general.getEnvValue('LOG_FILE') }; | ||
| } | ||
| else if (process.env.APPLITOOLS_LOG_DIR) { | ||
| options.handler = { type: 'rolling file', dirname: process.env.APPLITOOLS_LOG_DIR }; | ||
| else if (utils.general.getEnvValue('LOG_DIR')) { | ||
| options.handler = { type: 'rolling file', dirname: utils.general.getEnvValue('LOG_DIR') }; | ||
| } | ||
| else if (process.env.APPLITOOLS_SHOW_LOGS === 'true') { | ||
| else if (utils.general.getEnvValue('SHOW_LOGS', 'boolean')) { | ||
| options.handler = { type: 'console' }; | ||
@@ -168,2 +168,16 @@ } | ||
| }, | ||
| async withTime(promise, name) { | ||
| const start = Date.now(); | ||
| try { | ||
| const result = await promise; | ||
| const duration = Date.now() - start; | ||
| logger.log(`[TIMING] ${name}: ${duration}ms`); | ||
| return result; | ||
| } | ||
| catch (error) { | ||
| const duration = Date.now() - start; | ||
| logger.log(`[TIMING] ${name}: ${duration}ms (failed)`); | ||
| throw error; | ||
| } | ||
| }, | ||
| }; | ||
@@ -170,0 +184,0 @@ return logger; |
+1
-1
| { | ||
| "name": "@applitools/logger", | ||
| "version": "2.2.7", | ||
| "version": "2.2.8", | ||
| "description": "Applitools logger", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
+1
-0
@@ -23,2 +23,3 @@ import type { LogLevel } from './log-level'; | ||
| mask(value: string): void; | ||
| withTime<T>(promise: Promise<T>, name: string): Promise<T>; | ||
| } | ||
@@ -25,0 +26,0 @@ export type LoggerOptions = Omit<Partial<PrinterOptions>, 'handler' | 'level'> & { |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 3 instances
70182
1.91%938
1.85%3
-70%