Skip to content

Instantly share code, notes, and snippets.

@arafaysaleem
Created December 23, 2024 07:43
Show Gist options
  • Save arafaysaleem/b2ed4430cb11e4322661ac6644772547 to your computer and use it in GitHub Desktop.
Save arafaysaleem/b2ed4430cb11e4322661ac6644772547 to your computer and use it in GitHub Desktop.
Logger Analytics Service for Flutter
import 'dart:async';
// Config
import '../../config/config.dart';
// Monitoring
import 'analytics_client_base.dart';
class LoggerAnalyticsClient implements AnalyticsClientBase {
const LoggerAnalyticsClient();
@override
Future<void> toggleAnalyticsCollection(bool enabled) async {
appLogger.debug('toggleAnalyticsCollection($enabled)');
}
@override
Future<void> identifyUser({
required String userId,
required String email,
required String role,
}) async {
appLogger.debug('identifyUser($userId, $email, $role)');
}
@override
Future<void> resetUser() async {
appLogger.debug('resetUser');
}
@override
Future<void> trackEvent(String eventName, [Map<String, Object>? eventData]) async {
appLogger.debug('trackEvent($eventName, $eventData)');
}
@override
Future<void> trackScreenView(String routeName, String action) async {
appLogger.debug('trackScreenView($routeName, $action)');
}
@override
Future<void> trackBottomSheetView(String routeName, [Map<String, Object>? data]) async {
appLogger.debug('trackBottomSheetView($routeName, $data)');
}
@override
Future<void> trackDialogView(String dialogName, [Map<String, Object>? data]) async {
appLogger.debug('trackDialogView($dialogName, $data)');
}
@override
Future<void> trackAppForegrounded() async {
appLogger.debug('trackAppForegrounded');
}
@override
Future<void> trackAppBackgrounded() async {
appLogger.debug('trackAppBackgrounded');
}
@override
Future<void> trackButtonPressed(String buttonName, [Map<String, Object>? data]) async {
appLogger.debug('trackButtonPressed($buttonName, data: $data)');
}
@override
Future<void> trackPermissionRequest(String permission, String status) async {
appLogger.debug('trackPermissionRequested($permission, $status)');
}
@override
Future<void> trackNewAppOnboarding() async {
appLogger.debug('trackNewAppOnboarding');
}
@override
Future<void> trackAppCreated() async {
appLogger.debug('trackAppCreated');
}
@override
Future<void> trackAppUpdated() async {
appLogger.debug('trackAppUpdated');
}
@override
Future<void> trackAppDeleted() async {
appLogger.debug('trackAppDeleted');
}
@override
Future<void> trackTaskCompleted(int completedCount) async {
appLogger.debug('trackTaskCompleted(completedCount: $completedCount)');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment