Files
iiEsaywebUIapp/lib/core/utils/debug_logger.dart

74 lines
1.5 KiB
Dart
Raw Normal View History

2025-08-20 22:15:26 +05:30
import 'package:flutter/foundation.dart';
/// Centralized debug logging utility for the entire app
class DebugLogger {
static const bool _enabled = kDebugMode;
/// Log debug information
static void log(String message) {
if (_enabled) {
2025-08-21 19:11:17 +05:30
debugPrint('DEBUG: $message');
2025-08-20 22:15:26 +05:30
}
}
/// Log errors
static void error(String message, [Object? error]) {
if (_enabled) {
if (error != null) {
2025-08-21 19:11:17 +05:30
debugPrint('ERROR: $message: $error');
2025-08-20 22:15:26 +05:30
} else {
2025-08-21 19:11:17 +05:30
debugPrint('ERROR: $message');
2025-08-20 22:15:26 +05:30
}
}
}
/// Log warnings
static void warning(String message) {
if (_enabled) {
2025-08-21 19:11:17 +05:30
debugPrint('WARN: $message');
2025-08-20 22:15:26 +05:30
}
}
/// Log success/info messages
static void info(String message) {
if (_enabled) {
2025-08-21 19:11:17 +05:30
debugPrint('INFO: $message');
2025-08-20 22:15:26 +05:30
}
}
/// Log navigation events
static void navigation(String message) {
if (_enabled) {
2025-08-21 19:11:17 +05:30
debugPrint('NAV: $message');
2025-08-20 22:15:26 +05:30
}
}
/// Log authentication events
static void auth(String message) {
if (_enabled) {
2025-08-21 19:11:17 +05:30
debugPrint('AUTH: $message');
2025-08-20 22:15:26 +05:30
}
}
/// Log streaming events
static void stream(String message) {
if (_enabled) {
2025-08-21 19:11:17 +05:30
debugPrint('STREAM: $message');
2025-08-20 22:15:26 +05:30
}
}
/// Log validation events
static void validation(String message) {
if (_enabled) {
2025-08-21 19:11:17 +05:30
debugPrint('VALIDATION: $message');
2025-08-20 22:15:26 +05:30
}
}
/// Log storage events
static void storage(String message) {
if (_enabled) {
2025-08-21 19:11:17 +05:30
debugPrint('STORAGE: $message');
2025-08-20 22:15:26 +05:30
}
}
}