Reputation: 18379
What is a good logging approach in flutter.
Options
print() //bad
log() method
I am looking for something as easy as it is in native android. Eg, Log.d()which works in all cases like having to be called from widget or not.
Upvotes: 1
Views: 2768
Reputation: 2508
I recommend the third option, so that you can use different levels for your logs :
logger.v("Verbose log");
logger.d("Debug log");
logger.i("Info log");
logger.w("Warning log");
logger.e("Error log");
logger.wtf("What a terrible failure log");
Upvotes: 0
Reputation: 7799
print()
is not "bad" as you say.
However with logger
package you can display several types of logs like warnings, infos, debug logs... Which is visually better than print
.
Upvotes: 1