diff --git a/.idea/runConfigurations/tests_in_shelf.xml b/.idea/runConfigurations/tests_in_shelf.xml
new file mode 100644
index 00000000..a6105b27
--- /dev/null
+++ b/.idea/runConfigurations/tests_in_shelf.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pubspec.yaml b/pubspec.yaml
index c2ab0a1d..cacb7a60 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,14 +1,15 @@
-name: angel_shelf
-description: Shelf interop with Angel.
-version: 1.2.0
-author: Tobe O
-homepage: https://github.com/angel-dart/shelf
-environment:
- sdk: ">=1.19.0"
-dependencies:
- angel_framework: ">=1.1.0-alpha <2.0.0"
- shelf: ^0.6.0
-dev_dependencies:
- angel_test: ^1.1.0
- shelf_proxy: ^0.1.0
- test: ^0.12.0
\ No newline at end of file
+author: "Tobe O "
+description: "Shelf interop with Angel."
+homepage: "https://github.com/angel-dart/shelf"
+name: "angel_shelf"
+version: "1.2.0"
+dependencies:
+ angel_framework: ">=1.1.0-alpha <2.0.0"
+ shelf: "^0.6.0"
+dev_dependencies:
+ angel_test: "^1.1.0"
+ console: "^2.2.4"
+ shelf_proxy: "^0.1.0"
+ test: "^0.12.0"
+environment:
+ sdk: ">=1.19.0"
diff --git a/test/embed_shelf_test.dart b/test/embed_shelf_test.dart
index 51a8bbfa..12f99d11 100644
--- a/test/embed_shelf_test.dart
+++ b/test/embed_shelf_test.dart
@@ -2,13 +2,14 @@ import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'package:angel_client/io.dart' as c;
-import 'package:angel_diagnostics/angel_diagnostics.dart';
import 'package:angel_framework/angel_framework.dart';
import 'package:angel_shelf/angel_shelf.dart';
import 'package:angel_test/angel_test.dart';
import 'package:charcode/charcode.dart';
+import 'package:logging/logging.dart';
import 'package:shelf/shelf.dart' as shelf;
import 'package:test/test.dart';
+import 'pretty_logging.dart';
main() {
c.Angel client;
@@ -39,7 +40,7 @@ main() {
var app = new Angel()..lazyParseBodies = true;
app.get('/angel', 'Angel');
app.use(embedShelf(handler, throwOnNullResponse: true));
- await app.configure(logRequests());
+ app.logger = new Logger.detached('angel')..onRecord.listen(prettyLog);
server = await app.startServer(InternetAddress.LOOPBACK_IP_V4, 0);
client =
diff --git a/test/pretty_logging.dart b/test/pretty_logging.dart
new file mode 100644
index 00000000..76020997
--- /dev/null
+++ b/test/pretty_logging.dart
@@ -0,0 +1,32 @@
+import 'package:console/console.dart';
+import 'package:logging/logging.dart';
+
+/// Prints the contents of a [LogRecord] with pretty colors.
+void prettyLog(LogRecord record) {
+ var pen = new TextPen();
+ chooseLogColor(pen.reset(), record.level);
+ pen(record.toString());
+
+ if (record.error != null)
+ pen(record.error.toString());
+ if (record.stackTrace != null)
+ pen(record.stackTrace.toString());
+
+ pen();
+}
+
+/// Chooses a color based on the logger [level].
+void chooseLogColor(TextPen pen, Level level) {
+ if (level == Level.SHOUT)
+ pen.darkRed();
+ else if (level == Level.SEVERE)
+ pen.red();
+ else if (level == Level.WARNING)
+ pen.yellow();
+ else if (level == Level.INFO)
+ pen.magenta();
+ else if (level == Level.FINER)
+ pen.blue();
+ else if (level == Level.FINEST)
+ pen.darkBlue();
+}
diff --git a/test/support_shelf_test.dart b/test/support_shelf_test.dart
index 5f641b7a..56fabb27 100644
--- a/test/support_shelf_test.dart
+++ b/test/support_shelf_test.dart
@@ -1,9 +1,10 @@
-import 'package:angel_diagnostics/angel_diagnostics.dart';
import 'package:angel_framework/angel_framework.dart';
import 'package:angel_shelf/angel_shelf.dart';
import 'package:angel_test/angel_test.dart';
+import 'package:logging/logging.dart';
import 'package:shelf/shelf.dart' as shelf;
import 'package:test/test.dart';
+import 'pretty_logging.dart';
main() {
TestClient client;
@@ -21,7 +22,7 @@ main() {
});
await app.configure(supportShelf());
- await app.configure(logRequests());
+ app.logger = new Logger.detached('angel')..onRecord.listen(prettyLog);
client = await connectTo(app);
});