destroy method
Destroys the singleton instance of the BDLogger
class.
This also calls the clean
method on every BDCleanableLogHandler.
Implementation
Future<void> destroy() async {
_completeProcessingTask();
while (recordQueue.isNotEmpty) {
await _processLogRecord(recordQueue.removeFirst());
}
try {
for (final BDCleanableLogHandler handler
in _handlers.whereType<BDCleanableLogHandler>()) {
await handler.clean();
}
} on Object catch (error, stackTrace) {
_errorController.add(BDLogError(error, stackTrace));
}
_handlers.clear();
_instance = null;
await _errorController.sink.close();
return _errorController.close();
}