Logging Setup
Learn how to configure and use logging in flutter_soloud
Overview
flutter_soloud uses Dart's standard logging
package for diagnostic output, from severe warnings to fine-grained debug messages.
Basic Setup
Configure logging in your app's entry point:
import 'dart:developer' as dev;
import 'package:logging/logging.dart';
void main() {
// Set minimum log level
Logger.root.level = Level.FINE;
// Listen to log records
Logger.root.onRecord.listen((record) {
dev.log(
record.message,
time: record.time,
level: record.level.value,
name: record.loggerName,
zone: record.zone,
error: record.error,
stackTrace: record.stackTrace,
);
});
runApp(const MyApp());
}
Log Levels
Available logging levels in order of severity:
SHOUT
- Critical errorsSEVERE
- Serious errorsWARNING
- Warning messagesINFO
- General informationCONFIG
- Configuration eventsFINE
- Debug informationFINER
- Detailed debugFINEST
- Most detailed debug
Forward to Crash Reporting
Logger.root.onRecord.listen((record) {
if (record.level >= Level.SEVERE) {
// Forward to crash reporting service
Crashlytics.recordError(
record.error,
record.stackTrace,
reason: record.message,
);
}
});