Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Remove noisy log from startup #35954

Merged
merged 1 commit into from
Sep 7, 2022

Conversation

loic-sharma
Copy link
Member

This removes a noisy log from the startup path. Normally INFO logs are skipped by default, however, this particular log is sent before the verbosity level has been set.

This also adds a test to verify that a default Flutter Windows app does not output anything to stdout or stderr.

/cc @betrevisan

Fixes flutter/flutter#110231

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See testing the engine for instructions on
    writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

FML_LOG(INFO) << "populate_existing_damage was not defined, disabling "
"partial repaint. If you wish to enable partial repaint, "
"please define this callback.";
}
Copy link
Member Author

Choose a reason for hiding this comment

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

The embedder API has lots of other optional callbacks that no-op if they aren't provided. The embedder API does not log a message if those other optional callbacks aren't provided.

@loic-sharma
Copy link
Member Author

@cbracken I think we should cherry pick this, however, the Flutter Windows integration tests were added after the 3.3 branch was cut. I suppose I can cherry pick just the fix without the test. Do you have any concerns with that?

Copy link
Contributor

@yaakovschectman yaakovschectman left a comment

Choose a reason for hiding this comment

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

LGTM

std::string cout = cout_buffer.str();
std::string cerr = cerr_buffer.str();
EXPECT_TRUE(cout.empty());
EXPECT_TRUE(cerr.empty());
Copy link
Member

@cbracken cbracken Sep 7, 2022

Choose a reason for hiding this comment

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

You can use testing::internal::CaptureStdout() and testing::internal::GetCapturedStdout() to make this more succinct and avoid the possibility of copy/paste and forgetting to restore at the end.

Copy link
Member Author

Choose a reason for hiding this comment

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

I considered this but then found this message by the gtest folks: https://groups.google.com/g/googletestframework/c/7OTybZo-jp8

First of all, you should not use APIs marked as "internal".
They are not part of the public API, are not supported and are subject to change at any time.

And:

No, those APIs are internal for testing gTest itself.
They do so by overriding the stdout/stderr file descriptors and forwarding the data into a file, which means that they interfere with the actual output of the binary.
They could forward the output to the actual stdout/err, but that is more complex and there is no reason to do so on these internal APIs.

It is rather trivial to capture std::cout/std::cerr (not stdout/stderr) on your side, if you want.
Eg: http://stackoverflow.com/questions/5419356/redirect-stdout-stderr-to-a-string

I think if this becomes a common pattern we could introduce a helper to prevent possible gotchas.

Copy link
Member Author

@loic-sharma loic-sharma Sep 7, 2022

Choose a reason for hiding this comment

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

I accidentally added the autosubmit to this before letting you reply. Let me know if you have feedback, I'd be happy to send a follow-up pull request. Sorry about that!

Copy link
Member

Choose a reason for hiding this comment

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

Seems reasonable. If we find ourselves needing to do this more than once we should create an RAII wrapper that does the grabbing and restoring.

@cbracken
Copy link
Member

cbracken commented Sep 7, 2022

@cbracken I think we should cherry pick this, however, the Flutter Windows integration tests were added after the 3.3 branch was cut.

This is a super low-risk fix.

What is the impact? End-users aren't going to be seeing console logging, so I assume it affects developers only, and that it's visible even without the --verbose setting due to the timing?

This is pretty borderline for a cherry-pick. There's no crash or end-user-visible bug -- i.e. it doesn't affect flutter app users, just developers. It's a single log message to the console at startup. I'd expect the primary impacts are:

  • Users filing bugs about it and us having to expend effort triaging/de-duping them.
  • Annoyance/potential loss of confidence from developers?

I agree it's a very low-risk cherry-pick, but I don't think it qualifies for widespread serious user impact unless I'm misunderstanding the impact.

@loic-sharma
Copy link
Member Author

Yup that impact is exactly right: it just affects developers. Given that, I'll skip the cherry pick! :)

@loic-sharma loic-sharma added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 7, 2022
@auto-submit auto-submit bot merged commit ab8c96f into flutter:main Sep 7, 2022
@loic-sharma loic-sharma deleted the remove_callback_log branch September 7, 2022 21:18
@loic-sharma loic-sharma removed the autosubmit Merge PR when tree becomes green via auto submit App label Sep 7, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 7, 2022
cfontas pushed a commit to cfontas/engine that referenced this pull request Sep 14, 2022
Oleh-Sv pushed a commit to Oleh-Sv/engine that referenced this pull request Sep 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
embedder Related to the embedder API platform-windows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

populate_existing_damage was not defined, disabling partial repaint. If you wish to enable partial repaint, please define this callback.
4 participants