Skip to content

Commit

Permalink
use dart developer package for logging in dev mode
Browse files Browse the repository at this point in the history
  • Loading branch information
lohanidamodar committed Mar 23, 2024
1 parent c3c78df commit 78c07b1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/src/http.dart
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class Http {
);
_supervisors.add(supervisor);
supervisor.resume();
dev.log('Worker ${i.toString()} ready.', name: 'Fine');
dev.log('Worker ${i.toString()} ready.', name: 'FINE');
}
}

Expand Down
5 changes: 5 additions & 0 deletions lib/src/isolate_entry_point.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'dart:developer' as dev;
import 'dart:isolate';

import 'isolate_message.dart';
Expand All @@ -14,6 +15,10 @@ Future<void> entrypoint(IsolateMessage message) async {
message.sendPort.send(receivePort.sendPort);
receivePort.listen((data) async {
if (data == IsolateSupervisor.messageClose) {
dev.log(
'Received close message on isolate ${message.context}',
name: 'FINE',
);
await message.server.stop();
receivePort.close();
}
Expand Down
2 changes: 2 additions & 0 deletions lib/src/isolate_supervisor.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'dart:developer' as dev;
import 'dart:isolate' as iso;

class IsolateSupervisor {
Expand All @@ -20,6 +21,7 @@ class IsolateSupervisor {
}

void stop() {
dev.log('Stopping isolate $context', name: 'FINE');
_isolateSendPort?.send(messageClose);
receivePort.close();
}
Expand Down

0 comments on commit 78c07b1

Please sign in to comment.