OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 patch bool debugger({bool when: true, | 5 patch bool debugger({bool when: true, |
6 String message}) native "Developer_debugger"; | 6 String message}) native "Developer_debugger"; |
7 | 7 |
8 patch Object inspect(Object object) native "Developer_inspect"; | 8 patch Object inspect(Object object) native "Developer_inspect"; |
9 | 9 |
10 patch log({int sequenceNumber, | 10 patch log(String message, |
11 int millisecondsSinceEpoch, | 11 {DateTime time, |
12 int level, | 12 int sequenceNumber, |
13 String name, | 13 int level: 0, |
14 String message, | 14 String name: '', |
15 Zone zone, | 15 Zone zone, |
16 Object error, | 16 Object error, |
17 StackTrace stackTrace}) native "Developer_log"; | 17 StackTrace stackTrace}) { |
| 18 if (message is! String) { |
| 19 throw new ArgumentError(message, "message", "Must be a String"); |
| 20 } |
| 21 if (time == null) { |
| 22 time = new DateTime.now(); |
| 23 } |
| 24 if (time is! DateTime) { |
| 25 throw new ArgumentError(time, "time", "Must be a DateTime"); |
| 26 } |
| 27 if (sequenceNumber == null) { |
| 28 sequenceNumber = _nextSequenceNumber; |
| 29 } else { |
| 30 _nextSequenceNumber = sequenceNumber + 1; |
| 31 } |
| 32 return _log(message, |
| 33 time.millisecondsSinceEpoch, |
| 34 sequenceNumber, |
| 35 level, |
| 36 name, |
| 37 zone, |
| 38 error, |
| 39 stackTrace); |
| 40 } |
| 41 |
| 42 int _nextSequenceNumber = 0; |
| 43 |
| 44 _log(String message, |
| 45 int timestamp, |
| 46 int sequenceNumber, |
| 47 int level, |
| 48 String name, |
| 49 Zone zone, |
| 50 Object error, |
| 51 StackTrace stackTrace) native "Developer_log"; |
OLD | NEW |