agentsqripts
Version:
Comprehensive static code analysis toolkit for identifying technical debt, security vulnerabilities, performance issues, and code quality problems
42 lines (40 loc) • 1.87 kB
JavaScript
/**
* @file Log warning message
* @description Single responsibility: Display warning information with semantic console method
*
* This utility ensures warnings are displayed with proper semantic meaning and consistent
* visual formatting. Using console.warn instead of console.log allows log filtering tools
* and IDEs to properly categorize these messages as warnings rather than general output.
*
* Design rationale:
* - Uses console.warn to maintain semantic correctness for tooling
* - Warning emoji provides immediate visual distinction from success/error messages
* - Double space after emoji improves readability and alignment
* - Consistent with established warning patterns across the platform
*/
/**
* Log warning message with proper semantic categorization
*
* Technical function: Outputs a warning message using console.warn with warning emoji prefix
*
* Implementation rationale:
* - console.warn instead of console.log ensures proper log level categorization
* - Warning emoji (⚠️) provides immediate visual recognition of issue severity
* - Double space after emoji aligns text properly and improves readability
* - Template literal maintains consistent formatting with other console utilities
*
* Edge cases handled:
* - Non-string messages will be converted to string by JavaScript's implicit conversion
* - Empty messages will display just the warning emoji
*
* Alternative approaches considered:
* - Using console.log with yellow text: Rejected to maintain semantic meaning
* - Adding severity levels: Rejected as this utility focuses on simple warnings
* - Custom warning levels: Rejected to keep the interface simple and predictable
*
* @param {string} message - Warning message to display to the user
*/
function logWarning(message) {
console.warn(`⚠️ ${message}`);
}
module.exports = logWarning;