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

Side by Side Diff: tools/testing/dart/utils.dart

Issue 16958003: Moving timing info to utils.dart:DebugLogger (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « tools/testing/dart/browser_controller.dart ('k') | no next file » | 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 library utils; 5 library utils;
6 6
7 import 'dart:io'; 7 import 'dart:io';
8 import 'dart:async'; 8 import 'dart:async';
9 import 'dart:utf' as utf; 9 import 'dart:utf' as utf;
10 10
(...skipping 22 matching lines...) Expand all
33 msg += ": $error"; 33 msg += ": $error";
34 // TODO(floitsch): once the dart-executable that is bundled 34 // TODO(floitsch): once the dart-executable that is bundled
35 // with the Dart sources is updated, uncomment the following 35 // with the Dart sources is updated, uncomment the following
36 // lines. 36 // lines.
37 // var trace = getAttachedStackTrace(error); 37 // var trace = getAttachedStackTrace(error);
38 // if (trace != null) msg += "\nStackTrace: $trace"; 38 // if (trace != null) msg += "\nStackTrace: $trace";
39 return msg; 39 return msg;
40 } 40 }
41 static void info(String msg, [error]) { 41 static void info(String msg, [error]) {
42 msg = _formatErrorMessage(msg, error); 42 msg = _formatErrorMessage(msg, error);
43 _print("Info: $msg"); 43 _print("$_datetime Info: $msg");
44 } 44 }
45 45
46 static void warning(String msg, [error]) { 46 static void warning(String msg, [error]) {
47 msg = _formatErrorMessage(msg, error); 47 msg = _formatErrorMessage(msg, error);
48 _print("Warning: $msg"); 48 _print("$_datetime Warning: $msg");
49 } 49 }
50 50
51 static void error(String msg, [error]) { 51 static void error(String msg, [error]) {
52 msg = _formatErrorMessage(msg, error); 52 msg = _formatErrorMessage(msg, error);
53 _print("Error: $msg"); 53 _print("$_datetime Error: $msg");
54 } 54 }
55 55
56 static void _print(String msg) { 56 static void _print(String msg) {
57 if (_sink != null) { 57 if (_sink != null) {
58 _sink.writeln(msg); 58 _sink.writeln(msg);
59 } else { 59 } else {
60 print(msg); 60 print(msg);
61 } 61 }
62 } 62 }
63
64 static String get _datetime => "${new DateTime.now()}";
63 } 65 }
64 66
65 List<int> encodeUtf8(String string) { 67 List<int> encodeUtf8(String string) {
66 return utf.encodeUtf8(string); 68 return utf.encodeUtf8(string);
67 } 69 }
68 70
69 // TODO(kustermann,ricow): As soon we have a debug log we should log 71 // TODO(kustermann,ricow): As soon we have a debug log we should log
70 // invalid utf8-encoded input to the log. 72 // invalid utf8-encoded input to the log.
71 // Currently invalid bytes will be replaced by a replacement character. 73 // Currently invalid bytes will be replaced by a replacement character.
72 String decodeUtf8(List<int> bytes) { 74 String decodeUtf8(List<int> bytes) {
73 return utf.decodeUtf8(bytes); 75 return utf.decodeUtf8(bytes);
74 } 76 }
75 77
OLDNEW
« no previous file with comments | « tools/testing/dart/browser_controller.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698