-
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
10 changed files
with
94 additions
and
70 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
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,3 +1,7 @@ | ||
## 1.1.1 | ||
|
||
- support json data source from json file | ||
|
||
## 1.1.0 | ||
|
||
- add logging | ||
|
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
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,37 +1,35 @@ | ||
// 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; | ||
import 'package:cli_util/cli_logging.dart'; | ||
|
||
export 'package:cli_util/cli_logging.dart' show Progress; | ||
|
||
/// Flutter Launcher Icons Logger | ||
class JLogger { | ||
late Logger _logger; | ||
|
||
/// Returns true if this is a verbose logger | ||
final bool isVerbose; | ||
|
||
/// Gives access to internal logger | ||
Logger get rawLogger => _logger; | ||
|
||
/// Creates a instance of [JLogger]. | ||
/// In case [isVerbose] is `true`, | ||
/// it logs all the [verbose] logs to console | ||
JLogger(this.isVerbose) { | ||
final ansi = Ansi(Ansi.terminalSupportsAnsi); | ||
_logger = | ||
isVerbose ? Logger.verbose(ansi: ansi) : Logger.standard(ansi: ansi); | ||
} | ||
|
||
/// Logs error messages | ||
void error(Object? message) => _logger.stderr('⚠️$message'); | ||
|
||
/// Prints to console if [isVerbose] is true | ||
void verbose(Object? message) => _logger.trace(message.toString()); | ||
|
||
/// Prints to console | ||
void info(Object? message) => _logger.stdout(message.toString()); | ||
|
||
/// Shows progress in console | ||
Progress progress(String message) => _logger.progress(message); | ||
} |
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