plantTree method
Attach a logging mechanism.
Implementation
void plantTree(LoggingTree tree) {
if (_disposed) {
throw StateError(
'LoggingManager(name: ${logger.fullName}) is disposed',
);
}
// Remove previous tree.
removeTree();
_loggingTree = tree;
final logStream = logger.onRecord;
final StreamSubscription<LogRecord> logsSubscription;
if (logStream.isBroadcast) {
logsSubscription = logStream.listen(addLogRecord);
} else {
logsSubscription = logStream.asBroadcastStream().listen(addLogRecord);
}
_loggingTree!.onPlant(logsSubscription);
}