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

Side by Side Diff: pkg/analysis_server/test/stress/utilities/logger.dart

Issue 2611593002: Rework the replay test to be more correct (Closed)
Patch Set: Created 3 years, 11 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
OLDNEW
(Empty)
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
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.
4
5 /**
6 * A utility class used to write logging information during a test.
7 */
8 class Logger {
9 /**
10 * The width of the field in which labels are printed.
11 */
12 static const int _labelWidth = 8;
13
14 /**
15 * The separator used to separate the label from the content.
16 */
17 static const String _separator = ' : ';
18
19 /**
20 * The sink to which the logged information should be written.
21 */
22 final StringSink sink;
23
24 /**
25 * Initialize a newly created logger to write to the given [sink].
26 */
27 Logger(this.sink);
28
29 /**
30 * Log the given information.
31 *
32 * The [label] is used to indicate the kind of information being logged, while
33 * the [content] contains the actual information. If a list of [arguments] is
34 * provided, then they will be written after the content.
35 */
36 void log(String label, String content, {List<String> arguments = null}) {
37 for (int i = _labelWidth - label.length; i > 0; i--) {
38 sink.write(' ');
39 }
40 sink.write(label);
41 sink.write(_separator);
42 sink.write(content);
43 arguments?.forEach((String argument) {
44 sink.write(' ');
45 sink.write(argument);
46 });
47 sink.writeln();
48 }
49 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/stress/utilities/git.dart ('k') | pkg/analysis_server/test/stress/utilities/server.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698