diff --git a/assets/asset_manager.cc b/assets/asset_manager.cc index 9833eee923257..fcbe71b11a9ff 100644 --- a/assets/asset_manager.cc +++ b/assets/asset_manager.cc @@ -47,7 +47,7 @@ bool AssetManager::GetAsBuffer(const std::string& asset_name, return true; } } - FXL_DLOG(ERROR) << "Could not find asset: " << asset_name; + FXL_DLOG(WARNING) << "Could not find asset: " << asset_name; return false; } diff --git a/common/settings.h b/common/settings.h index c6c3159766a37..ffb80131f029d 100644 --- a/common/settings.h +++ b/common/settings.h @@ -71,6 +71,7 @@ struct Settings { bool enable_software_rendering = false; bool using_blink = false; bool skia_deterministic_rendering_on_cpu = false; + bool verbose_logging = false; std::string log_tag = "flutter"; std::string icu_data_path; diff --git a/shell/common/shell.cc b/shell/common/shell.cc index 82591c6d499e2..468ebaf99b9e0 100644 --- a/shell/common/shell.cc +++ b/shell/common/shell.cc @@ -23,6 +23,7 @@ #include "lib/fxl/files/path.h" #include "lib/fxl/files/unique_fd.h" #include "lib/fxl/functional/make_copyable.h" +#include "lib/fxl/log_settings.h" #include "lib/fxl/logging.h" #include "third_party/dart/runtime/include/dart_tools_api.h" #include "third_party/skia/include/core/SkGraphics.h" @@ -149,6 +150,11 @@ std::unique_ptr Shell::Create( blink::Settings settings, Shell::CreateCallback on_create_platform_view, Shell::CreateCallback on_create_rasterizer) { + fxl::LogSettings log_settings; + log_settings.min_log_level = + settings.verbose_logging ? fxl::LOG_INFO : fxl::LOG_ERROR; + fxl::SetLogSettings(log_settings); + if (!task_runners.IsValid() || !on_create_platform_view || !on_create_rasterizer) { return nullptr; diff --git a/shell/common/switches.cc b/shell/common/switches.cc index 82da6ee180af8..f8883a2a3f471 100644 --- a/shell/common/switches.cc +++ b/shell/common/switches.cc @@ -155,6 +155,9 @@ blink::Settings SettingsFromCommandLine(const fxl::CommandLine& command_line) { settings.skia_deterministic_rendering_on_cpu = command_line.HasOption(FlagForSwitch(Switch::SkiaDeterministicRendering)); + settings.verbose_logging = + command_line.HasOption(FlagForSwitch(Switch::VerboseLogging)); + command_line.GetOptionValue(FlagForSwitch(Switch::FLX), &settings.flx_path); command_line.GetOptionValue(FlagForSwitch(Switch::FlutterAssetsDir), diff --git a/shell/common/switches.h b/shell/common/switches.h index 6b67b1f6a1567..4f694d37475fa 100644 --- a/shell/common/switches.h +++ b/shell/common/switches.h @@ -113,6 +113,11 @@ DEF_SWITCH(UseTestFonts, "will make font resolution default to the Ahem test font on all " "platforms (See https://www.w3.org/Style/CSS/Test/Fonts/Ahem/). " "This option is only available on the desktop test shells.") +DEF_SWITCH(VerboseLogging, + "verbose-logging", + "By default, only errors are logged. This flag enabled logging at " + "all severity levels. This is NOT a per shell flag and affect log " + "levels for all shells in the process.") DEF_SWITCH(RunForever, "run-forever", "In non-interactive mode, keep the shell running after the Dart "