Use pretty_logging

This commit is contained in:
Tobe O 2019-10-12 09:57:59 -04:00
parent 6d71707673
commit 4e792e4c34
3 changed files with 10 additions and 5 deletions

View file

@ -2,10 +2,11 @@ import 'package:angel_container/mirrors.dart';
import 'package:angel_framework/angel_framework.dart'; import 'package:angel_framework/angel_framework.dart';
import 'package:angel_framework/http.dart'; import 'package:angel_framework/http.dart';
import 'package:logging/logging.dart'; import 'package:logging/logging.dart';
import 'package:pretty_logging/pretty_logging.dart';
main() async { main() async {
// Logging set up/boilerplate // Logging set up/boilerplate
Logger.root.onRecord.listen(print); Logger.root.onRecord.listen(prettyLog);
// Create our server. // Create our server.
var app = Angel( var app = Angel(

View file

@ -98,11 +98,14 @@ class Routable extends Router<RequestHandler> {
middleware ??= []; middleware ??= [];
final handlers = <RequestHandler>[]; final handlers = <RequestHandler>[];
// Merge @Middleware declaration, if any // Merge @Middleware declaration, if any
var reflector = _container?.reflector;
if (reflector != null && reflector is! ThrowingReflector) {
Middleware middlewareDeclaration = Middleware middlewareDeclaration =
getAnnotation<Middleware>(handler, _container?.reflector); getAnnotation<Middleware>(handler, _container?.reflector);
if (middlewareDeclaration != null) { if (middlewareDeclaration != null) {
handlers.addAll(middlewareDeclaration.handlers); handlers.addAll(middlewareDeclaration.handlers);
} }
}
final handlerSequence = <RequestHandler>[]; final handlerSequence = <RequestHandler>[];
handlerSequence.addAll(middleware ?? []); handlerSequence.addAll(middleware ?? []);

View file

@ -32,4 +32,5 @@ dependencies:
dev_dependencies: dev_dependencies:
http: ^0.12.0 http: ^0.12.0
io: ^0.3.0 io: ^0.3.0
pretty_logging: ^1.0.0
test: ^1.0.0 test: ^1.0.0