Comment on page

Integrating Firebase Crashlytics to the logger

To report errors in Firebase Crashlytics, you can extend the CodenicLogger class and override the error method:
class FirebaseLogger extends CodenicLogger {
// When a UID is assigned to the logger, then set the
// Firebase Crashlytics's user identifier to the same UID
set userId(String? userId) {
super.userId = userId;
FirebaseCrashlytics.instance.setUserIdentifier(userId ?? '');
void error(
MessageLog messageLog, {
dynamic error,
StackTrace? stackTrace,
}) {
super.error(messageLog, error: error, stackTrace: stackTrace);
// When an error is logged, submit the error to Firebase Crashlytics
reason: messageLog,