or run

npx @tessl/cli init
Log in

Version

Files

tile.json

task.mdevals/scenario-1/

Alert Level Logger

Build a simple CLI logger that displays messages with different visual intensities based on alert levels. The logger should use high-visibility colors for critical alerts and standard colors for normal messages.

Requirements

Your logger should support four alert levels with different visual treatments:

  1. CRITICAL - Highest visibility alert that stands out prominently
  2. WARNING - High visibility warning that is noticeable but less intense than critical
  3. SUCCESS - High visibility success indicator
  4. INFO - Standard visibility informational message

Each alert level should be displayed with a distinct color. Critical, warning, and success messages should use high-visibility color variants, while info messages should use standard color intensity.

Implementation

Create a module that exports a log function:

@generates

API

/**
 * Logs a message with appropriate visual styling based on alert level.
 *
 * @param {string} level - The alert level: 'CRITICAL', 'WARNING', 'SUCCESS', or 'INFO'
 * @param {string} message - The message to display
 * @returns {string} The formatted message with color codes
 */
function log(level, message) {
  // IMPLEMENTATION HERE
}

module.exports = { log };

Test Cases

  • Given level "CRITICAL" and message "System failure", it returns a high-visibility red colored string @test
  • Given level "WARNING" and message "Low disk space", it returns a high-visibility yellow colored string @test
  • Given level "SUCCESS" and message "Deployment complete", it returns a high-visibility green colored string @test
  • Given level "INFO" and message "Process started", it returns a standard cyan colored string @test

Dependencies { .dependencies }

picocolors { .dependency }

Provides terminal color formatting support.