provideLogger<R> function

Future<R> provideLogger<R>(
  1. ILogger logger,
  2. Future<R> body()
)

Provides a logger to the code inside body.

Implementation

Future<R> provideLogger<R>(ILogger logger, Future<R> Function() body) async {
  var result = await runZoned<Future<R>>(
    body,
    zoneValues: {
      _breakingBadQuotesLoggerModuleKey: logger,
    },
  );

  return result;
}