Index: pkg/barback/lib/src/transformer/transform_logger.dart |
diff --git a/pkg/barback/lib/src/transformer/transform_logger.dart b/pkg/barback/lib/src/transformer/transform_logger.dart |
index 44ac420377cc93d80e7a6ddfbbf51077b8599258..5f26a9793f92f47d39806abe2e33407bf4d83a1d 100644 |
--- a/pkg/barback/lib/src/transformer/transform_logger.dart |
+++ b/pkg/barback/lib/src/transformer/transform_logger.dart |
@@ -4,15 +4,13 @@ |
library barback.transformer.transform_logger; |
-import 'package:source_maps/span.dart'; |
import 'package:source_span/source_span.dart'; |
import '../asset/asset_id.dart'; |
import '../log.dart'; |
-import '../span_wrapper.dart'; |
typedef void LogFunction(AssetId asset, LogLevel level, String message, |
- Span span); |
+ SourceSpan span); |
/// Object used to report warnings and errors encountered while running a |
/// transformer. |
@@ -26,10 +24,8 @@ class TransformLogger { |
/// If [asset] is provided, the log entry is associated with that asset. |
/// Otherwise it's associated with the primary input of [transformer]. If |
/// present, [span] indicates the location in the input asset that caused the |
- /// error. It may be a [SourceSpan] or a [Span], although the former is |
- /// recommended. |
- void info(String message, {AssetId asset, span}) { |
- if (span != null && span is SourceSpan) span = new SpanWrapper(span, false); |
+ /// error. |
+ void info(String message, {AssetId asset, SourceSpan span}) { |
_logFunction(asset, LogLevel.INFO, message, span); |
} |
@@ -39,10 +35,8 @@ class TransformLogger { |
/// If [asset] is provided, the log entry is associated with that asset. |
/// Otherwise it's associated with the primary input of [transformer]. If |
/// present, [span] indicates the location in the input asset that caused the |
- /// error. It may be a [SourceSpan] or a [Span], although the former is |
- /// recommended. |
- void fine(String message, {AssetId asset, span}) { |
- if (span != null && span is SourceSpan) span = new SpanWrapper(span, false); |
+ /// error. |
+ void fine(String message, {AssetId asset, SourceSpan span}) { |
_logFunction(asset, LogLevel.FINE, message, span); |
} |
@@ -51,10 +45,8 @@ class TransformLogger { |
/// If [asset] is provided, the log entry is associated with that asset. |
/// Otherwise it's associated with the primary input of [transformer]. If |
/// present, [span] indicates the location in the input asset that caused the |
- /// error. It may be a [SourceSpan] or a [Span], although the former is |
- /// recommended. |
- void warning(String message, {AssetId asset, span}) { |
- if (span != null && span is SourceSpan) span = new SpanWrapper(span, false); |
+ /// error. |
+ void warning(String message, {AssetId asset, SourceSpan span}) { |
_logFunction(asset, LogLevel.WARNING, message, span); |
} |
@@ -63,8 +55,7 @@ class TransformLogger { |
/// If [asset] is provided, the log entry is associated with that asset. |
/// Otherwise it's associated with the primary input of [transformer]. If |
/// present, [span] indicates the location in the input asset that caused the |
- /// error. It may be a [SourceSpan] or a [Span], although the former is |
- /// recommended. |
+ /// error. |
/// |
/// Logging any errors will cause Barback to consider the transformation to |
/// have failed, much like throwing an exception. This means that neither the |
@@ -74,8 +65,7 @@ class TransformLogger { |
/// Unlike throwing an exception, this doesn't cause a transformer to stop |
/// running. This makes it useful in cases where a single input may have |
/// multiple errors that the user wants to know about. |
- void error(String message, {AssetId asset, span}) { |
- if (span != null && span is SourceSpan) span = new SpanWrapper(span, false); |
+ void error(String message, {AssetId asset, SourceSpan span}) { |
_logFunction(asset, LogLevel.ERROR, message, span); |
} |
} |