UNPKG

n8n-nodes-arubacentralnextgen

Version:

n8n community node for Aruba Central NextGen API integration with modern monitoring and management capabilities

79 lines (78 loc) 2.36 kB
"use strict"; // helpers/logger.ts Object.defineProperty(exports, "__esModule", { value: true }); exports.logWarning = exports.logDebug = exports.logger = void 0; exports.isDebugMode = isDebugMode; exports.debug = debug; exports.info = info; exports.warn = warn; exports.error = error; // Check if debug mode is enabled in the given execution context function isDebugMode(executeFunctions) { try { return executeFunctions.getNodeParameter('debugMode', 0, false) === true; } catch (error) { return false; } } // Debug level logs - only shown when debug mode is enabled function debug(message, data, executeFunctions) { if (executeFunctions && !isDebugMode(executeFunctions)) { return; } if (data !== undefined) { if (typeof data === 'object') { try { const serializedData = JSON.stringify(data, null, 2); console.log(`[ARUBA CENTRAL DEBUG] ${message}`, serializedData); } catch (e) { console.log(`[ARUBA CENTRAL DEBUG] ${message}`, data); } } else { console.log(`[ARUBA CENTRAL DEBUG] ${message}`, data); } } else { console.log(`[ARUBA CENTRAL DEBUG] ${message}`); } } // Info level logs function info(message, data) { if (data !== undefined) { console.info(`[ARUBA CENTRAL INFO] ${message}`, data); } else { console.info(`[ARUBA CENTRAL INFO] ${message}`); } } // Warning level logs function warn(message, data) { if (data !== undefined) { console.warn(`[ARUBA CENTRAL WARNING] ${message}`, data); } else { console.warn(`[ARUBA CENTRAL WARNING] ${message}`); } } // Error level logs - always shown function error(message, error) { if (error instanceof Error) { console.error(`[ARUBA CENTRAL ERROR] ${message}: ${error.message}`); if (error.stack) { console.error(`[ARUBA CENTRAL ERROR] Stack trace:`, error.stack); } } else if (error !== undefined) { console.error(`[ARUBA CENTRAL ERROR] ${message}:`, error); } else { console.error(`[ARUBA CENTRAL ERROR] ${message}`); } } // Legacy exports for compatibility exports.logger = { debug, info, warn, error }; exports.logDebug = debug; exports.logWarning = warn;