I'm using https://pub.dartlang.org/packages/logging, but it doesn't display anything to my log. This is my code:
class Test {
final Logger log = new Logger('testLogger');
Future<String> join() async {
try {
return await func();
} on Exception catch (e) {
log.severe('access denied!');
return null;
}
}
Logging options in Flutter In Flutter there are different sets of options available for logging, one of which is FLog. FLog is an advanced logging framework that provides a quick & simple logging solution. FLog is written in Dart and provides many of the advanced features needed for logging.
We all know that feeling of going through thousands and thousands of lines of log messages without any useful info at all. In Flutter there are different sets of options available for logging, one of which is FLog. FLog is an advanced logging framework that provides a quick & simple logging solution.
Generally logging messages in flutter can be done using 2 ways. 1. Using stdout & stderr. Generally printing a message on the console screen is done using the print () method by importing ‘dart:io’ & by invoking stdout & stderr.
So to use developer.log function in flutter print to console or devtool, you need to just import ‘dart:developer’ as devlog & now use it as shown below ( devlog.log (“This is Log message from developer log method”); ) output: developer.log console log will only be show in devTool
You need to register a log reporter.
From https://pub.dartlang.org/packages/logging
main() {
Logger.root.level = Level.ALL;
Logger.root.onRecord.listen((LogRecord rec) {
debugPrint('${rec.level.name}: ${rec.time}: ${rec.message}');
});
runApp(...);
}
You can have log reporters that write to a file or to some logging server, ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With