docs
evals
scenario-1
scenario-10
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
Build a simple CLI logging utility that respects standard environment variables to control color output. The logger should automatically adapt to different environments (CI systems, terminals with disabled colors, forced color environments) and provide multiple log levels with appropriate coloring.
The logger must support four log levels, each with distinct visual styling:
The logger must respect standard environment variables that control color output:
NO_COLOR is set (any value), all color output must be disabledFORCE_COLOR is set (any value), color output must be enabled even in non-TTY environmentsCI is set (any value), color output should be enabled to support CI environment logsTERM=dumb case appropriatelyThe logger should provide a way to manually override automatic color detection for testing purposes or custom configurations.
NO_COLOR=1, calling logger.error("Failed") outputs plain text without ANSI codes @testFORCE_COLOR=1, calling logger.success("Done") includes green ANSI codes even if output is not to a TTY @testlogger.info("Starting") produces cyan-colored output if supported @test/**
* Logger object with methods for different log levels
*/
const logger = {
/**
* Log an informational message
* @param {string} message - The message to log
*/
info(message) {},
/**
* Log a success message
* @param {string} message - The message to log
*/
success(message) {},
/**
* Log a warning message
* @param {string} message - The message to log
*/
warning(message) {},
/**
* Log an error message
* @param {string} message - The message to log
*/
error(message) {}
};
/**
* Create a logger instance with custom color configuration
* @param {boolean} enableColors - Whether to enable color output
* @returns {object} Logger object with info, success, warning, error methods
*/
function createLogger(enableColors) {}
module.exports = { logger, createLogger };Provides terminal color formatting with automatic environment variable support for NO_COLOR, FORCE_COLOR, CI, and TERM detection.