Skip to content

Commit c885976

Browse files
authored
Log print messages at warning (#1720)
This comes up repeatedly that Builder authors are confused when they add print calls and can't see the messages because info lines get overwritten without `--verbose`, and `--verbose` adds a bunch of extra noise that drowns out the wanted messages. Since we expect Builder authors to rely on `log.info` for long term logging they want to keep at info and `print` to be used only for short term stuff it should be safe to up the level to warning.
1 parent d59618a commit c885976

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

build/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.12.7+4
2+
3+
- `print` calls inside a Builder will now log at warning instead of info.
4+
15
## 0.12.7+3
26

37
- Throw when attempting to use a `BuildStep` after it has been completed.

build/lib/src/builder/logging.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@ Logger get log => Zone.current[logKey] as Logger ?? _default;
1313

1414
/// Runs [fn] in an error handling [Zone].
1515
///
16-
/// Any calls to [print] will be logged with `log.info`, and any errors will be
17-
/// logged with `log.severe`.
16+
/// Any calls to [print] will be logged with `log.warning`, and any errors will
17+
/// be logged with `log.severe`.
1818
///
1919
/// Completes with the first error or result of `fn`, whichever comes first.
2020
Future<T> scopeLogAsync<T>(Future<T> fn(), Logger log) {
2121
var done = new Completer<T>();
2222
runZoned(fn,
2323
zoneSpecification:
2424
new ZoneSpecification(print: (self, parent, zone, message) {
25-
log.info(message);
25+
log.warning(message);
2626
}),
2727
zoneValues: {logKey: log},
2828
onError: (Object e, StackTrace s) {

build/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: build
2-
version: 0.12.7+3
2+
version: 0.12.7+4
33
description: A build system for Dart.
44
author: Dart Team <[email protected]>
55
homepage: https://github.com/dart-lang/build/tree/master/build

0 commit comments

Comments
 (0)