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/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(

View file

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

View file

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