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

Side by Side Diff: runtime/observatory/tests/service/logging_test.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 unified diff | Download patch
« no previous file with comments | « runtime/lib/developer.dart ('k') | runtime/observatory/tests/ui/log.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // VMOptions=--compile_all --error_on_bad_type --error_on_bad_override
5 4
6 import 'dart:developer' as developer; 5 import 'dart:developer' as developer;
7 import 'package:observatory/service_io.dart'; 6 import 'package:observatory/service_io.dart';
8 import 'package:unittest/unittest.dart'; 7 import 'package:unittest/unittest.dart';
9 import 'package:logging/logging.dart'; 8 import 'package:logging/logging.dart';
10 9
11 import 'test_helper.dart'; 10 import 'test_helper.dart';
12 11
13 void init() { 12 void init() {
14 Logger.root.level = Level.ALL; 13 Logger.root.level = Level.ALL;
15 Logger.root.onRecord.listen((logRecord) { 14 Logger.root.onRecord.listen((logRecord) {
16 developer.log( 15 developer.log(
16 logRecord.message,
17 time: logRecord.time,
17 sequenceNumber: logRecord.sequenceNumber, 18 sequenceNumber: logRecord.sequenceNumber,
18 millisecondsSinceEpoch: logRecord.time.millisecondsSinceEpoch,
19 level: logRecord.level.value, 19 level: logRecord.level.value,
20 name: logRecord.loggerName, 20 name: logRecord.loggerName,
21 message: logRecord.message,
22 zone: null, 21 zone: null,
23 error: logRecord.error, 22 error: logRecord.error,
24 stackTrace: logRecord.stackTrace); 23 stackTrace: logRecord.stackTrace);
25 }); 24 });
26 } 25 }
27 26
28 void run() { 27 void run() {
29 developer.debugger(); 28 developer.debugger();
30 Logger.root.fine('Hey Buddy!'); 29 Logger.root.fine('Hey Buddy!');
31 developer.debugger(); 30 developer.debugger();
(...skipping 15 matching lines...) Expand all
47 expect(event.logRecord['level'], equals(Level.INFO)); 46 expect(event.logRecord['level'], equals(Level.INFO));
48 expect(event.logRecord['message'].valueAsString, equals('YES')); 47 expect(event.logRecord['message'].valueAsString, equals('YES'));
49 expect(event.logRecord['time'], new isInstanceOf<DateTime>()); 48 expect(event.logRecord['time'], new isInstanceOf<DateTime>());
50 }), 49 }),
51 ]; 50 ];
52 51
53 main(args) => runIsolateTests(args, 52 main(args) => runIsolateTests(args,
54 tests, 53 tests,
55 testeeBefore: init, 54 testeeBefore: init,
56 testeeConcurrent: run); 55 testeeConcurrent: run);
OLDNEW
« no previous file with comments | « runtime/lib/developer.dart ('k') | runtime/observatory/tests/ui/log.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698