Skip to content

Commit

Permalink
fix deprecation, rm old logging
Browse files Browse the repository at this point in the history
  • Loading branch information
maks committed Jun 29, 2023
1 parent b0ca771 commit 08d1d5e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
10 changes: 5 additions & 5 deletions lib/src/application.dart
Original file line number Diff line number Diff line change
Expand Up @@ -130,18 +130,18 @@ class Application {
connect = HttpServer.bind(ip, int.parse(port));
}

runZoned(() {
connect.then((final server) {
runZonedGuarded(() {
connect.then((final server) {
log('Server running $ip on port: $port, $MY_HTTP_ROOT_PATH');
server.listen((final request) {
log('${request.connectionInfo?.remoteAddress.address}:${request.connectionInfo?.localPort} - ${request.method} ${request.uri}');

virtDir.serveRequest(request);
});
});
},
onError: (Object e, StackTrace stackTrace) =>
Log.e('Error running http server: $e $stackTrace'));
}, (error, stack) {
Log.e('Error running http server: $error $stack');
});
}

void watch(final String folder, final Config config) {
Expand Down
8 changes: 3 additions & 5 deletions lib/src/listings.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import 'dart:io';

import 'package:bonsai/bonsai.dart';
import 'package:front_matter_ml/front_matter_ml.dart' as fm;
import 'package:logging/logging.dart';
import 'package:path/path.dart' as path;
import 'package:yaml/yaml.dart' as yaml;

final Logger _logger = Logger('dsg.Generator');

class ListingConfig {
final Map<dynamic, dynamic> _config;
String get path => _config['path'] as String;
Expand Down Expand Up @@ -43,7 +41,7 @@ Future<Map<String, List<Map>?>> getListingsMap(

final sortFunction = (sortDirection == 'DESC') ? desc : asc;

_logger.info('SORT listing: $key BY: $sortBy');
Log.d('listings.dart', 'SORT listing: $key BY: $sortBy');

listings[key]?.sort(sortFunction);
});
Expand Down Expand Up @@ -88,7 +86,7 @@ Future<Map<String, dynamic>> _getFrontMatter(
return (await fm.parseFile(filePath, delimiter: yamldelimiter))
.data.value.cast<String, dynamic>();
} catch (e) {
_logger.severe(e, 'failed parsing frontmatter in: $filePath');
Log.e('failed parsing frontmatter in: $filePath', e);
return <String, dynamic>{};
}
}
Expand Down

0 comments on commit 08d1d5e

Please sign in to comment.