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

Unified Diff: pkg/barback/lib/src/transformer/transform_logger.dart

Issue 430973002: Only support the new source_span spans in barback. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/barback/lib/src/span_wrapper.dart ('k') | pkg/barback/pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
}
« no previous file with comments | « pkg/barback/lib/src/span_wrapper.dart ('k') | pkg/barback/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698