exe static method

void exe(
  1. String msg, {
  2. String? name,
  3. DevLevel level = DevLevel.normal,
  4. bool? isLog,
  5. bool? isMultConsole,
  6. bool? isDebug,
  7. int? colorInt,
  8. String? fileInfo,
  9. Object? error,
  10. StackTrace? stackTrace,
  11. String? printOnceIfContains,
  12. int debounceMs = 0,
  13. String? debounceKey,
})

Execute custom final func with purple text or blue text with multiple consoles @parammsg: The message string to be logged @paramname: Custom name/tag for the log entry; if null, uses the level name (with prefix for multi-console) @paramlevel: The log level (verbose, normal, info, success, warn, error, fatal), defaults to normal @paramisLog: If set to true, logs regardless of the static enable flag @paramisMultConsole: If true, enables multi-console logging mode with dbgPrt/unlPrt prefix @paramisDebug: If true, prints only on debug mode; if null, uses static isDebugPrint @paramcolorInt: ANSI color code (0 to 107) for text color customization @paramfileInfo: Custom file location string; if null, auto-detects from stack trace @paramerror: Associated error object to be logged alongside the message @paramstackTrace: Stack trace information for debugging @paramprintOnceIfContains: If provided, only prints once when message contains this keyword @paramdebounceMs: Debounce time interval in milliseconds, logs within this interval will be discarded @paramdebounceKey: Custom key for debounce identification (if not provided, uses msg|devLevel|name as fallback)

Implementation

static void exe(String msg,
    {String? name,
    DevLevel level = DevLevel.normal,
    bool? isLog,
    bool? isMultConsole,
    bool? isDebug,
    int? colorInt,
    String? fileInfo,
    Object? error,
    StackTrace? stackTrace,
    String? printOnceIfContains,
    int debounceMs = 0,
    String? debounceKey}) {
  int ci = colorInt ?? (_exeColorMap[level] ?? 44);
  final String theFileInfo = fileInfo ?? _getFileLocation();
  bool isMult = isMultConsole != null && isMultConsole;
  var theName = name ?? level.toString().split('.').last;
  bool? isDbgPrint = isDebug ?? Dev.isDebugPrint;
  final levelMap = {DevLevel.warn: 1000, DevLevel.error: 2000};

  if (isMult) {
    final prefix = isDbgPrint == null || isDbgPrint ? 'dbgPrt' : 'unlPrt';
    theName =
        '$prefix-$theName'; // Use prefix directly since enum names no longer start with 'log'
  }

  DevColorizedLog.logCustom(
    msg,
    devLevel: level,
    enable: Dev.enable,
    colorInt: ci,
    isLog: isLog,
    isMultConsole: isMultConsole,
    isDebugPrint: isDbgPrint,
    fileInfo: theFileInfo,
    name: theName,
    level: levelMap[level] ?? 0,
    execFinalFunc: true,
    error: error,
    stackTrace: stackTrace,
    printOnceIfContains: printOnceIfContains,
    debounceMs: debounceMs,
    debounceKey: debounceKey,
  );
}