Files
FamilyMealPlanner/MealMood/Services/CrashlyticsService.swift
T
2026-04-27 15:31:54 +02:00

29 lines
855 B
Swift

import FirebaseCrashlytics
enum CrashlyticsService {
static func setUserProperties(isPremium: Bool) {
Crashlytics.crashlytics().setCustomValue(isPremium, forKey: "is_premium")
}
static func log(_ message: String) {
Crashlytics.crashlytics().log(message)
}
static func record(_ error: Error, context: String? = nil) {
if let context {
Crashlytics.crashlytics().setCustomValue(context, forKey: "context")
}
Crashlytics.crashlytics().record(error: error)
}
static func record(message: String, context: String? = nil) {
if let context {
Crashlytics.crashlytics().setCustomValue(context, forKey: "context")
}
Crashlytics.crashlytics().record(
exceptionModel: ExceptionModel(name: "AppError", reason: message)
)
}
}