Flutter Android 日志过多且冗长

Xtr*_*evX 8 android ios dart flutter

当我在 Android 模拟器或物理设备上运行应用程序时,日志很大,而且常常令人难以承受......我想知道如何仅获取相关输出,而不是像这样的不必要的日志:

W/om.tejas.pethu( 7618): Accessing hidden method Ljava/security/spec/ECParameterSpec;->getCurveName()Ljava/lang/String; (greylist, reflection, allowed)
I/ProviderInstaller( 7618): Installed default security provider GmsCore_OpenSSL
W/om.tejas.pethu( 7618): Accessing hidden field Ljava/net/Socket;->impl:Ljava/net/SocketImpl; (greylist, reflection, allowed)
W/om.tejas.pethu( 7618): Accessing hidden method Ldalvik/system/CloseGuard;->get()Ldalvik/system/CloseGuard; (greylist,core-platform-api, linking, allowed)
W/om.tejas.pethu( 7618): Accessing hidden method Ldalvik/system/CloseGuard;->open(Ljava/lang/String;)V (greylist,core-platform-api, linking, allowed)
W/om.tejas.pethu( 7618): Accessing hidden field Ljava/io/FileDescriptor;->descriptor:I (greylist, JNI, allowed)
W/om.tejas.pethu( 7618): Accessing hidden method Ljava/security/spec/ECParameterSpec;->setCurveName(Ljava/lang/String;)V (greylist, reflection, allowed)
W/om.tejas.pethu( 7618): Accessing hidden method Ldalvik/system/BlockGuard;->getThreadPolicy()Ldalvik/system/BlockGuard$Policy; (greylist,core-platform-api, linking, allowed)
W/om.tejas.pethu( 7618): Accessing hidden method Ldalvik/system/BlockGuard$Policy;->onNetwork()V (greylist, linking, allowed)
Run Code Online (Sandbox Code Playgroud)

请记住,在运行时会生成大量详细日志...这使得很难找到哪些日志是详细且不必要的以及您期望看到的日志print('Hello');

Hello请注意,在像上面这样的详细日志中查找该字符串至少可以说是一项挑战。

这是与干净且不冗长的 iOS 日志相比:

Launching lib/main.dart on iPhone 11 Pro Max in debug mode...
Xcode build done.                                           33.6s
Configuring the default Firebase app...
Configured the default Firebase app __FIRAPP_DEFAULT.
Connecting to VM Service at ws://127.0.0.1:54149/6CwtGLU6Ci0=/ws
Run Code Online (Sandbox Code Playgroud)

值得注意的是,在运行时,只显示重要的日志/必要的日志,如 Dart 编译器错误和print语句。

我要问的是:

  1. 有没有办法过滤这些日志,以便我只获取 Dart/Flutter 编译器产生的打印语句和错误?

  2. 如果不可能,有什么方法可以以非 hacky 的方式停止这些日志吗?我不想深入研究在幕后为我们编写的任何复杂的源代码......

flutter run -d <device-id>如果不超过上述,则产生相同的多余日志:

An Observatory debugger and profiler on sdk gphone x86 arm is available at:
http://127.0.0.1:55302/9hN29j0-dRE=/
W/DynamiteModule( 7842): Local module descriptor class for providerinstaller not found.
I/DynamiteModule( 7842): Considering local module providerinstaller:0 and remote module providerinstaller:0
W/ProviderInstaller( 7842): Failed to load providerinstaller module: No acceptable module found. Local version is 0 and remote version is 0.
I/TetheringManager( 7842): registerTetheringEventCallback:com.tejas.pethub
I/om.tejas.pethu( 7842): The ClassLoaderContext is a special shared library.
I/om.tejas.pethu( 7842): Waiting for a blocking GC ProfileSaver
I/om.tejas.pethu( 7842): The ClassLoaderContext is a special shared library.
I/om.tejas.pethu( 7842): The ClassLoaderContext is a special shared library.
V/NativeCrypto( 7842): Registering com/google/android/gms/org/conscrypt/NativeCrypto's 286 native methods...
W/om.tejas.pethu( 7842): Accessing hidden method Ljava/security/spec/ECParameterSpec;->getCurveName()Ljava/lang/String; (greylist, reflection, allowed)
I/ProviderInstaller( 7842): Installed default security provider GmsCore_OpenSSL
W/om.tejas.pethu( 7842): Accessing hidden field Ljava/net/Socket;->impl:Ljava/net/SocketImpl; (greylist, reflection, allowed)
W/om.tejas.pethu( 7842): Accessing hidden method Ldalvik/system/CloseGuard;->get()Ldalvik/system/CloseGuard; (greylist,core-platform-api, linking, allowed)
W/om.tejas.pethu( 7842): Accessing hidden method Ldalvik/system/CloseGuard;->open(Ljava/lang/String;)V (greylist,core-platform-api, linking, allowed)
W/om.tejas.pethu( 7842): Accessing hidden field Ljava/io/FileDescriptor;->descriptor:I (greylist, JNI, allowed)
W/om.tejas.pethu( 7842): Accessing hidden method Ljava/security/spec/ECParameterSpec;->setCurveName(Ljava/lang/String;)V (greylist, reflection, allowed)
W/om.tejas.pethu( 7842): Accessing hidden method Ldalvik/system/BlockGuard;->getThreadPolicy()Ldalvik/system/BlockGuard$Policy; (greylist,core-platform-api, linking, allowed)
W/om.tejas.pethu( 7842): Accessing hidden method Ldalvik/system/BlockGuard$Policy;->onNetwork()V (greylist, linking, allowed)
Run Code Online (Sandbox Code Playgroud)

感谢您给我的任何帮助,我很感激!