Vaibhav Surve ec6c24464e Refactor logging mechanism across services and widgets
- Introduced a new `logSafe` function for consistent logging with sensitivity handling.
- Replaced direct logger calls with `logSafe` in `api_service.dart`, `app_initializer.dart`, `auth_service.dart`, `permission_service.dart`, and `my_image_compressor.dart`.
- Enhanced error handling and logging in various service methods to capture exceptions and provide more context.
- Updated image compression logging to include quality and size metrics.
- Improved app initialization logging to capture success and error states.
- Ensured sensitive information is not logged directly.
2025-06-25 12:10:57 +05:30

45 lines
1.0 KiB
Dart

import 'package:flutter/material.dart';
import 'package:marco/helpers/services/app_initializer.dart';
import 'package:marco/view/my_app.dart';
import 'package:provider/provider.dart';
import 'package:marco/helpers/theme/app_notifier.dart';
import 'package:marco/helpers/services/app_logger.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await initLogging();
logSafe("App starting...");
try {
await initializeApp();
logSafe("App initialized successfully.");
runApp(
ChangeNotifierProvider<AppNotifier>(
create: (_) => AppNotifier(),
child: const MyApp(),
),
);
} catch (e, stacktrace) {
logSafe('App failed to initialize.',
level: LogLevel.error,
error: e,
stackTrace: stacktrace,
);
runApp(
const MaterialApp(
home: Scaffold(
body: Center(
child: Text(
"Failed to initialize the app.",
style: TextStyle(color: Colors.red),
),
),
),
),
);
}
}