Index: runtime/lib/developer.dart |
diff --git a/runtime/lib/developer.dart b/runtime/lib/developer.dart |
index 529c53ac0803db3ada0016ba428b73e5f96ed028..f5a4a0022dbd6319bf8121a040677cdead5d9cb0 100644 |
--- a/runtime/lib/developer.dart |
+++ b/runtime/lib/developer.dart |
@@ -7,11 +7,45 @@ patch bool debugger({bool when: true, |
patch Object inspect(Object object) native "Developer_inspect"; |
-patch log({int sequenceNumber, |
- int millisecondsSinceEpoch, |
- int level, |
- String name, |
- String message, |
+patch log(String message, |
+ {DateTime time, |
+ int sequenceNumber, |
+ int level: 0, |
+ String name: '', |
Zone zone, |
Object error, |
- StackTrace stackTrace}) native "Developer_log"; |
+ StackTrace stackTrace}) { |
+ if (message is! String) { |
+ throw new ArgumentError(message, "message", "Must be a String"); |
+ } |
+ if (time == null) { |
+ time = new DateTime.now(); |
+ } |
+ if (time is! DateTime) { |
+ throw new ArgumentError(time, "time", "Must be a DateTime"); |
+ } |
+ if (sequenceNumber == null) { |
+ sequenceNumber = _nextSequenceNumber; |
+ } else { |
+ _nextSequenceNumber = sequenceNumber + 1; |
+ } |
+ return _log(message, |
+ time.millisecondsSinceEpoch, |
+ sequenceNumber, |
+ level, |
+ name, |
+ zone, |
+ error, |
+ stackTrace); |
+} |
+ |
+int _nextSequenceNumber = 0; |
+ |
+_log(String message, |
+ int timestamp, |
+ int sequenceNumber, |
+ int level, |
+ String name, |
+ Zone zone, |
+ Object error, |
+ StackTrace stackTrace) native "Developer_log"; |