| OLD | NEW |
| 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.transform_logger; | 5 library barback.transform_logger; |
| 6 | 6 |
| 7 import 'package:source_maps/span.dart'; | 7 import 'package:source_maps/span.dart'; |
| 8 | 8 |
| 9 import 'asset_id.dart'; | 9 import 'asset_id.dart'; |
| 10 import 'log.dart'; | 10 import 'log.dart'; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 /// Logs an informative message. | 22 /// Logs an informative message. |
| 23 /// | 23 /// |
| 24 /// If [asset] is provided, the log entry is associated with that asset. | 24 /// If [asset] is provided, the log entry is associated with that asset. |
| 25 /// Otherwise it's associated with the primary input of [transformer]. | 25 /// Otherwise it's associated with the primary input of [transformer]. |
| 26 /// If [span] is provided, indicates the location in the input asset that | 26 /// If [span] is provided, indicates the location in the input asset that |
| 27 /// caused the message. | 27 /// caused the message. |
| 28 void info(String message, {AssetId asset, Span span}) { | 28 void info(String message, {AssetId asset, Span span}) { |
| 29 _logFunction(asset, LogLevel.INFO, message, span); | 29 _logFunction(asset, LogLevel.INFO, message, span); |
| 30 } | 30 } |
| 31 | 31 |
| 32 /// Logs a message that won't be displayed unless the user is running in |
| 33 /// verbose mode. |
| 34 /// |
| 35 /// If [asset] is provided, the log entry is associated with that asset. |
| 36 /// Otherwise it's associated with the primary input of [transformer]. |
| 37 /// If [span] is provided, indicates the location in the input asset that |
| 38 /// caused the message. |
| 39 void fine(String message, {AssetId asset, Span span}) { |
| 40 _logFunction(asset, LogLevel.FINE, message, span); |
| 41 } |
| 42 |
| 32 /// Logs a warning message. | 43 /// Logs a warning message. |
| 33 /// | 44 /// |
| 34 /// If [asset] is provided, the log entry is associated with that asset. | 45 /// If [asset] is provided, the log entry is associated with that asset. |
| 35 /// Otherwise it's associated with the primary input of [transformer]. | 46 /// Otherwise it's associated with the primary input of [transformer]. |
| 36 /// If present, [span] indicates the location in the input asset that caused | 47 /// If present, [span] indicates the location in the input asset that caused |
| 37 /// the warning. | 48 /// the warning. |
| 38 void warning(String message, {AssetId asset, Span span}) { | 49 void warning(String message, {AssetId asset, Span span}) { |
| 39 _logFunction(asset, LogLevel.WARNING, message, span); | 50 _logFunction(asset, LogLevel.WARNING, message, span); |
| 40 } | 51 } |
| 41 | 52 |
| 42 /// Logs an error message. | 53 /// Logs an error message. |
| 43 /// | 54 /// |
| 44 /// If [asset] is provided, the log entry is associated with that asset. | 55 /// If [asset] is provided, the log entry is associated with that asset. |
| 45 /// Otherwise it's associated with the primary input of [transformer]. | 56 /// Otherwise it's associated with the primary input of [transformer]. |
| 46 /// If present, [span] indicates the location in the input asset that caused | 57 /// If present, [span] indicates the location in the input asset that caused |
| 47 /// the error. | 58 /// the error. |
| 48 // TODO(sigmund,nweiz): clarify when an error should be logged or thrown. | 59 // TODO(sigmund,nweiz): clarify when an error should be logged or thrown. |
| 49 void error(String message, {AssetId asset, Span span}) { | 60 void error(String message, {AssetId asset, Span span}) { |
| 50 _logFunction(asset, LogLevel.ERROR, message, span); | 61 _logFunction(asset, LogLevel.ERROR, message, span); |
| 51 } | 62 } |
| 52 } | 63 } |
| OLD | NEW |