print static method

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

Log supporting on multiple consoles @paramobject: The object to be logged (will be converted to string) @paramname: Custom name/tag for the log entry; if null, uses the level name with dbgPrt/unlPrt prefix @paramlevel: The log level (verbose, normal, info, success, warn, error, fatal), defaults to normal @paramcolorInt: ANSI color code (0 to 107) for text color customization @paramisLog: If set to true, logs regardless of the static enable flag @paramfileLocation: Custom file location string; if null, auto-detects from stack trace @paramisDebug: If true, prints only on debug mode; if null, uses static isDebugPrint @paramexecFinalFunc: If true, executes the custom final function exeFinalFunc @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 print(Object? object,
    {String? name,
    DevLevel level = DevLevel.normal,
    int? colorInt,
    bool? isLog,
    String? fileLocation,
    bool? isDebug,
    bool? execFinalFunc,
    Object? error,
    StackTrace? stackTrace,
    String? printOnceIfContains,
    int debounceMs = 0,
    String? debounceKey}) {
  final String fileInfo =
      fileLocation != null ? '($fileLocation): ' : _getFileLocation();
  int ci = colorInt ??
      (_logColorMap[level] ??
          (defaultColorInt ?? (isMultConsoleLog ? 4 : 0)));
  String msg = "$object";
  bool? isDbgPrint = isDebug ?? Dev.isDebugPrint;
  var theName = name ?? level.toString().split('.').last;

  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:
        execFinalFunc != null && execFinalFunc ? _exeColorMap[level]! : ci,
    isLog: isLog,
    isMultConsole: true,
    isDebugPrint: isDbgPrint,
    fileInfo: fileInfo,
    name: theName,
    error: error,
    stackTrace: stackTrace,
    execFinalFunc: execFinalFunc,
    printOnceIfContains: printOnceIfContains,
    debounceMs: debounceMs,
    debounceKey: debounceKey,
  );
}