Are logs drom dart:developer are visible in release mode of flutter app?
No, developer.log
does not display information on the terminal when in release mode.
But print()
will surely print all in any mode.
You can check that on android devices connected in USB, using adb logcat
or adb logcat | grep flutter
Just be careful not to print large amounts of information with developers.log
, as it won't truncate the string, as print actually does.
package: https://pub.dev/packages/dart_log
I actually created a package to handle logs(mentioned above), which allows you to define whether or not to print logs in release mode, and define the amount of characters that can be printed. all logs are linked to the file in exact line that logger was called, so you can click on it, and easily open the file that dispatched the log :)
Paul Kastel
The shiznit, film expert, flutter/dart mobile software engineer, hack-scribbler, narcissus, I am the best #lovelife
Updated on December 28, 2022Comments
-
Paul Kastel over 1 year
In release mode of flutter app, are console logs printed out with
log
method fromdart:developer
are visible? From docs of release mode we can read thatDebugging information is stripped out. Debugging is disabled.
and I assume it strip out everything printed with
debugPrint
method, but I couldn't found anything aboutlog
method.Same goes for output with
print
method? Are those prints will be visible for user who will be reading device log output or not? Dart linter only says that print should be avoided in production code, I assume because of print output visibility.Chapter in flutter docs about logging says how to use them but not really answer questions above.