@xyz/whois
Version:
A powerful TypeScript/JavaScript tool for comprehensive domain analysis, featuring detailed WHOIS data with registration dates, registrars, and domain status. Offers SSL certificate extraction (with PEM support), DNS records, and server details. Includes
48 lines (47 loc) • 1.3 kB
JavaScript
;
/**
* Utility functions for logging and error handling
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.logError = logError;
exports.logWarning = logWarning;
exports.logInfo = logInfo;
/**
* Logs an error message in debug mode
* @param debug Whether debug mode is enabled
* @param section The section where the error occurred
* @param error The error object or message
*/
function logError(debug, section, error) {
if (debug) {
console.error(`[DEBUG] Error fetching ${section}:`, error);
}
}
/**
* Logs a warning message in debug mode
* @param debug Whether debug mode is enabled
* @param section The section where the warning occurred
* @param message The warning message
*/
function logWarning(debug, section, message) {
if (debug) {
console.warn(`[DEBUG] Warning in ${section}:`, message);
}
}
/**
* Logs an informational message in debug mode
* @param debug Whether debug mode is enabled
* @param section The section where the info occurred
* @param message The informational message
*/
function logInfo(debug, section, message) {
if (debug) {
console.log(`[DEBUG] ${section}:`, message);
}
}
// Export all logging functions
exports.default = {
logError,
logWarning,
logInfo,
};