-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
89 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,5 @@ | |
pubspec.lock | ||
|
||
/assets | ||
/lib/json2model_gen | ||
/lib/json2model_gen | ||
json2model.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
## 1.1.0 | ||
|
||
- add logging | ||
|
||
## 1.0.9 | ||
|
||
- json_parse_model readme link | ||
|
||
## 1.0.7 | ||
|
||
- add more information for install | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
import 'dart:async'; | ||
|
||
import 'package:logging/logging.dart'; | ||
|
||
const Symbol logKey = #buildLog; | ||
|
||
final _default = Logger('build.fallback'); | ||
|
||
/// The log instance for the currently running BuildStep. | ||
/// | ||
/// Will be `null` when not running within a build. | ||
Logger get log => Zone.current[logKey] as Logger? ?? _default; | ||
|
||
/// Runs [fn] in an error handling [Zone]. | ||
/// | ||
/// Any calls to [print] will be logged with `log.warning`, and any errors will | ||
/// be logged with `log.severe`. | ||
/// | ||
/// Completes with the first error or result of `fn`, whichever comes first. | ||
Future<T> scopeLogAsync<T>(Future<T> Function() fn, Logger log) { | ||
var done = Completer<T>(); | ||
runZonedGuarded(fn, (e, st) { | ||
log.severe('', e, st); | ||
if (done.isCompleted) return; | ||
done.completeError(e, st); | ||
}, zoneSpecification: ZoneSpecification(print: (self, parent, zone, message) { | ||
log.warning(message); | ||
}), zoneValues: {logKey: log})?.then((result) { | ||
if (done.isCompleted) return; | ||
done.complete(result); | ||
}); | ||
return done.future; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters