Added diagnostics

This commit is contained in:
thosakwe 2016-09-19 03:38:30 -04:00
parent 1e084ec4d6
commit af8a02b07f
4 changed files with 11 additions and 3 deletions

4
.gitignore vendored
View file

@ -115,4 +115,6 @@ packages
**/packages
bin/packages
.idea
.idea
logs/**/*.txt

View file

@ -1,7 +1,9 @@
import 'dart:async';
import 'dart:io';
import 'package:angel/angel.dart';
import 'package:angel_diagnostics/angel_diagnostics.dart';
import 'package:angel_framework/angel_framework.dart';
import 'package:intl/intl.dart';
main() async {
runZoned(startServer, onError: onError);
@ -9,11 +11,12 @@ main() async {
startServer() async {
Angel app = await createServer();
DateFormat dateFormat = new DateFormat("y-MM-dd");
InternetAddress host = new InternetAddress(app.properties['host']);
int port = app.properties['port'];
var now = new DateTime.now();
await app.startServer(host, port);
print("Angel server listening on ${host.address}:${port}");
await new DiagnosticsServer(app, new File("logs/${dateFormat.format(now)}.txt")).startServer(host, port);
}
onError(error, [StackTrace stackTrace]) {

2
logs/README.md Normal file
View file

@ -0,0 +1,2 @@
# Logs
This folder contains logs from each day. Once the server is started, it creates a log in this directory.

View file

@ -7,6 +7,7 @@ publish_to: none
dependencies:
angel_auth: ^1.0.0-dev
angel_configuration: ^1.0.0-dev
angel_diagnostics: ^1.0.0-dev
angel_framework: ^1.0.0-dev
angel_mongo: ^1.0.0-dev
angel_mustache: ^1.0.0-dev