closeScope method

  1. @override
Future<void> closeScope(
  1. LogScope scope, {
  2. required bool success,
  3. required Duration duration,
  4. Object? error,
  5. StackTrace? stackTrace,
})
override

Ends a scoped operation.

Implementation

@override
Future<void> closeScope(
  LogScope scope, {
  required bool success,
  required Duration duration,
  Object? error,
  StackTrace? stackTrace,
}) async {
  if (isInteractiveTerminal) {
    _clearSpinnerLine();
    scopeStack.removeWhere((s) => s.scope.id == scope.id);
    if (scopeStack.isEmpty) _stopTimer();

    stdout.writeln(formatScopeComplete(scope, success, duration));

    _drawSpinner();
  } else {
    stdout.writeln(formatScopeEnd(scope, success, duration));
  }
}