Skip to content
5 changes: 5 additions & 0 deletions lib/src/rohd_bridge_logger.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ abstract class RohdBridgeLogger {
bool continueOnError = false,
bool enableDebugMesage = false,
}) {
// Clean up existing logger subscriptions and file sink
Logger.root.clearListeners();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I didn't notice this before, but I think we actually want to capture the StreamSubscription returned by Logger.root.onRecord.listen and cancel that, rather than clear all the listeners on Logger.root. It is possible that users would have been adding their own listeners to Logger.root for other purposes.

fileSink?.close();
fileSink = null;

RohdBridgeLogger.continueOnError = continueOnError;
Logger.root.level = rootLevel;
_printLevel = printLevel;
Expand Down
Loading