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

Side by Side Diff: packages/barback/test/transformer/log.dart

Issue 3015713002: Roll to pickup pool changes
Patch Set: Created 3 years, 2 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
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 barback.test.transformer.log; 5 library barback.test.transformer.log;
6 6
7 import 'dart:async';
8
9 import 'package:barback/barback.dart'; 7 import 'package:barback/barback.dart';
10 import 'package:barback/src/utils.dart';
11 8
12 import 'mock.dart'; 9 import 'mock.dart';
13 10
14 /// A transformer that logs given entries during its apply. 11 /// A transformer that logs given entries during its apply.
15 class LogTransformer extends MockTransformer { 12 class LogTransformer extends MockTransformer {
16 /// The list of entries that it should log. 13 /// The list of entries that it should log.
17 /// 14 ///
18 /// Each entry has the log level followed by the message, like: 15 /// Each entry has the log level followed by the message, like:
19 /// 16 ///
20 /// error: This is the error message. 17 /// error: This is the error message.
21 final List<String> _entries; 18 final List<String> _entries;
22 19
23 LogTransformer(this._entries); 20 LogTransformer(this._entries);
24 21
25 bool doIsPrimary(AssetId id) => true; 22 bool doIsPrimary(AssetId id) => true;
26 23
27 void doApply(Transform transform) { 24 void doApply(Transform transform) {
28 for (var entry in _entries) { 25 for (var entry in _entries) {
29 var parts = entry.split(":"); 26 var parts = entry.split(":");
30 var logFn; 27 var logFn;
31 switch (parts[0]) { 28 switch (parts[0]) {
32 case "error": logFn = transform.logger.error; break; 29 case "error":
33 case "warning": logFn = transform.logger.warning; break; 30 logFn = transform.logger.error;
34 case "info": logFn = transform.logger.info; break; 31 break;
35 case "fine": logFn = transform.logger.fine; break; 32 case "warning":
33 logFn = transform.logger.warning;
34 break;
35 case "info":
36 logFn = transform.logger.info;
37 break;
38 case "fine":
39 logFn = transform.logger.fine;
40 break;
36 } 41 }
37 42
38 logFn(parts[1].trim()); 43 logFn(parts[1].trim());
39 } 44 }
40 } 45 }
41 } 46 }
OLDNEW
« no previous file with comments | « packages/barback/test/transformer/lazy_rewrite.dart ('k') | packages/barback/test/transformer/mock.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698