Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a 'builder label' for log messages #1100

Merged
merged 4 commits into from
Mar 7, 2018
Merged

Use a 'builder label' for log messages #1100

merged 4 commits into from
Mar 7, 2018

Conversation

natebosch
Copy link
Member

Closes #1069

Replaces the builder toString() with a more relevant label, and
changes AssetIds to something more reconizable.

  • Keep a buildLabel on BuildAction. Where possible this is a
    builderKey, but when that is missing or empty we fall back on the
    toString of the Builder.
  • Normalize AssetIds to package: URIs for non-root packages, and file
    path for root package.
  • Don't prefix newlines as messages are logged, these weren't working as
    implemented and would get swallowed by the StdIoLogger anyway.
  • Hardcode known build_runner Logger names and don't print their name
    with messages.
  • Always prefix messages from Builders (loggers with names we don't
    recognize) with a newline. This works well in the WARNING and SEVERE
    case but might not work as well for other messages - we can revist if
    necessary.
  • Don't print stack traces unless verbose logging is enabled.

Closes #1069

Replaces the builder `toString()` with a more relevant label, and
changes AssetIds to something more reconizable.

- Keep a `buildLabel` on `BuildAction`. Where possible this is a
  `builderKey`, but when that is missing or empty we fall back on the
  `toString` of the Builder.
- Normalize AssetIds to `package:` URIs for non-root packages, and file
  path for root package.
- Don't prefix newlines as messages are logged, these weren't working as
  implemented and would get swallowed by the StdIoLogger anyway.
- Hardcode known `build_runner` Logger names and don't print their name
  with messages.
- Always prefix messages from Builders (loggers with names we don't
  recognize) with a newline. This works well in the WARNING and SEVERE
  case but might not work as well for other messages - we can revist if
  necessary.
- Don't print stack traces unless verbose logging is enabled.
@natebosch natebosch requested a review from jakemac53 March 6, 2018 00:57
@googlebot googlebot added the cla: yes Google is happy with the PR contributors label Mar 6, 2018
@natebosch
Copy link
Member Author

The hardcoded logger names make me a littler nervous - some of the existing newline magic is also somewhat troubling, but I think it's still worth it to get the behavior we have.

This might solve #981 since it hides stack traces by default, but we can still discuss a BuildError class.

@@ -60,15 +60,6 @@ class BuildForInputLogger implements Logger {
if (logLevel >= Level.SEVERE) {
_errorWasSeen = true;
}
if (logLevel >= Level.WARNING) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we still want this - unless we stopped removing the asset that its running on from the description as well (and maybe even then).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Header splitting happens where we print now. This code path isn't realistically getting hit now, but if we fixed this we'd end up with a black line before the header, not splitting the header like we intended.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ack

@@ -60,10 +60,8 @@ main(List<String> args) async {
var result = await runDart('a', 'tool/build.dart',
args: ['build', '--delete-conflicting-outputs']);
expect(result.exitCode, 0, reason: result.stderr as String);
expect(
result.stdout,
contains('BuildDefinition: Invalidating asset graph due to '
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are these names no longer present or you just wanted to simplify the tests? I think they do provide some value personally (the names being there, I am ambivalent about the tests).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are no longer present. I felt like they mainly added value for us. The end user probably didn't care about the particulars ways we split up functionality in this package or the labels we gave them.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It gave you some indication of where the log was coming from but its probably true that for most users that didn't mean much.... I am ok with removing them.

@jakemac53
Copy link
Contributor

Should have read the full description first :).

The main thing I don't think we want is always prefixing messages with a newline - I believe that will break the existing logic that overwrites messages under WARNING level?

'BuildDefinition',
'Heartbeat'
];
return verbose || !knownNames.contains(record.loggerName)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like this is where we would only add the newline for >= WARNING?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I can add a level check here.

@natebosch
Copy link
Member Author

@jakemac53 - now only splitting on WARNING and above - any other concerns?

@natebosch natebosch merged commit e35186e into master Mar 7, 2018
@natebosch natebosch deleted the log-names branch March 7, 2018 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Google is happy with the PR contributors
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Log lines from builders are really long
3 participants