AmwalLoggerFunction typedef

AmwalLoggerFunction = void Function(dynamic error, StackTrace? stackTrace)

Function type for custom error logging implementations.

This typedef defines the signature for custom logger functions that can be set in the AmwalLogger. It provides a standardized way to handle error logging with optional stack trace information.

Parameters

  • error - The error object to be logged (can be any type)
  • stackTrace - Optional stack trace for debugging purposes

Usage Example

AmwalLoggerFunction customLogger = (error, stackTrace) {
  print('Custom Error: $error');
  if (stackTrace != null) {
    print('Stack Trace: $stackTrace');
  }
  // Send to external logging service
  analyticsService.trackError(error, stackTrace);
};

AmwalLogger.setLogger(customLogger);

Integration

This function type is used by:

  • Legacy AmwalLogger.setLogger for setting custom logging implementations
  • Legacy code that needs backward compatibility
  • Custom error handling and reporting systems

Implementation

typedef AmwalLoggerFunction = void Function(
    dynamic error, StackTrace? stackTrace);