From 4e792e4c34f9eb00ebcf92bc937fe1ac66fec070 Mon Sep 17 00:00:00 2001 From: Tobe O Date: Sat, 12 Oct 2019 09:57:59 -0400 Subject: [PATCH] Use pretty_logging --- example/main.dart | 3 ++- lib/src/core/routable.dart | 11 +++++++---- pubspec.yaml | 1 + 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/example/main.dart b/example/main.dart index 9d618393..f500270b 100644 --- a/example/main.dart +++ b/example/main.dart @@ -2,10 +2,11 @@ import 'package:angel_container/mirrors.dart'; import 'package:angel_framework/angel_framework.dart'; import 'package:angel_framework/http.dart'; import 'package:logging/logging.dart'; +import 'package:pretty_logging/pretty_logging.dart'; main() async { // Logging set up/boilerplate - Logger.root.onRecord.listen(print); + Logger.root.onRecord.listen(prettyLog); // Create our server. var app = Angel( diff --git a/lib/src/core/routable.dart b/lib/src/core/routable.dart index e98ac39a..a497c4d0 100644 --- a/lib/src/core/routable.dart +++ b/lib/src/core/routable.dart @@ -98,10 +98,13 @@ class Routable extends Router { middleware ??= []; final handlers = []; // Merge @Middleware declaration, if any - Middleware middlewareDeclaration = - getAnnotation(handler, _container?.reflector); - if (middlewareDeclaration != null) { - handlers.addAll(middlewareDeclaration.handlers); + var reflector = _container?.reflector; + if (reflector != null && reflector is! ThrowingReflector) { + Middleware middlewareDeclaration = + getAnnotation(handler, _container?.reflector); + if (middlewareDeclaration != null) { + handlers.addAll(middlewareDeclaration.handlers); + } } final handlerSequence = []; diff --git a/pubspec.yaml b/pubspec.yaml index 152229ab..2caf2790 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -32,4 +32,5 @@ dependencies: dev_dependencies: http: ^0.12.0 io: ^0.3.0 + pretty_logging: ^1.0.0 test: ^1.0.0