clearLog function

void clearLog()

Logging utilities for CLI applications.

This module provides simple file-based logging functionality for debugging and monitoring CLI operations. Logs are written to a 'morpheme_log.txt' file in the current working directory.

Note: Logging is automatically disabled in CI/CD environments to avoid unnecessary file operations. Clear the log file contents.

This function removes all existing content from the log file, effectively starting with a clean log. The operation is skipped in CI/CD environments.

Example:

// Start with a fresh log file
clearLog();

// Continue with normal operations
appendLogToFile('Starting application');

Implementation

/// Clear the log file contents.
///
/// This function removes all existing content from the log file,
/// effectively starting with a clean log. The operation is skipped
/// in CI/CD environments.
///
/// Example:
/// ```dart
/// // Start with a fresh log file
/// clearLog();
///
/// // Continue with normal operations
/// appendLogToFile('Starting application');
/// ```

void clearLog() {
  if (isCiCdEnvironment) return;

  join(current, 'morpheme_log.txt').write('');
}