printLog function

void printLog(
  1. String message,
  2. bool debug, {
  3. LogColor color = LogColor.reset,
})

Web platform implementation of debug logging.

This function provides debug logging for web platforms (browser environments). Unlike the IO platform version, this implementation doesn't support color coding since browsers don't typically support ANSI color codes in console output.

The function only outputs messages when debug mode is enabled, making it safe to use in production code.

Parameters:

  • message: The log message to print
  • debug: Whether debug mode is enabled (only prints if true)
  • color: Color parameter (ignored on web platform for compatibility)

Example:

printLog('Starting scraping process...', debug);
printLog('Data extracted successfully!', debug);
printLog('Network error occurred', debug);

Implementation

void printLog(String message, bool debug, {LogColor color = LogColor.reset}) {
  if (!debug) return;

  /// On web platforms, use standard print function
  /// Color parameter is ignored since browsers don't support ANSI colors
  print(message);
}