cleanupLogging method

  1. @protected
Future<void> cleanupLogging()

Clean up logging resources for this instance

Implementation

@protected
Future<void> cleanupLogging() async {
  await _logSubscription?.cancel();
  _logSubscription = null;

  if (_instanceLogger != null && _loggingInstanceId != null) {
    globalLoggerRegistry.remove('pubnub-$_loggingInstanceId');
    final current = _instanceLogger;
    if (current is StreamLogger) {
      await current.dispose();
    } else if (current is CompositeLogger) {
      for (final target in current.targets) {
        if (target is StreamLogger) {
          await target.dispose();
        }
      }
    }
    _instanceLogger = null;
  }
}