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

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

Issue 808713003: Remove barback from the repo. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years 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
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 library barback.test.transformer.log;
6
7 import 'dart:async';
8
9 import 'package:barback/barback.dart';
10 import 'package:barback/src/utils.dart';
11
12 import 'mock.dart';
13
14 /// A transformer that logs given entries during its apply.
15 class LogTransformer extends MockTransformer {
16 /// The list of entries that it should log.
17 ///
18 /// Each entry has the log level followed by the message, like:
19 ///
20 /// error: This is the error message.
21 final List<String> _entries;
22
23 LogTransformer(this._entries);
24
25 bool doIsPrimary(AssetId id) => true;
26
27 void doApply(Transform transform) {
28 for (var entry in _entries) {
29 var parts = entry.split(":");
30 var logFn;
31 switch (parts[0]) {
32 case "error": logFn = transform.logger.error; break;
33 case "warning": logFn = transform.logger.warning; break;
34 case "info": logFn = transform.logger.info; break;
35 case "fine": logFn = transform.logger.fine; break;
36 }
37
38 logFn(parts[1].trim());
39 }
40 }
41 }
OLDNEW
« no previous file with comments | « pkg/barback/test/transformer/lazy_rewrite.dart ('k') | pkg/barback/test/transformer/many_to_one.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698