Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(536)

Unified Diff: runtime/lib/developer.dart

Issue 1266053003: Make dart:developer log more user friendly (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/lib/developer.cc ('k') | runtime/observatory/tests/service/logging_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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";
« no previous file with comments | « runtime/lib/developer.cc ('k') | runtime/observatory/tests/service/logging_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698