Update: 2026-05-08 15:19:08

This commit is contained in:
Hamza-Ayed
2026-05-08 15:19:08 +03:00
parent 07fd3f9ba7
commit 72424bf92c
2 changed files with 13 additions and 4 deletions

View File

@@ -2,16 +2,19 @@ import 'dart:developer' as developer;
import 'package:flutter/foundation.dart';
class AppLogger {
/// Master toggle for logging. Set to false to disable all logs.
static bool isLoggingEnabled = kDebugMode;
/// Custom print function that only logs in debug mode.
static void print(String message, {String name = 'Musadaq'}) {
if (kDebugMode) {
if (isLoggingEnabled) {
developer.log(message, name: name);
}
}
/// Custom error logger
static void error(String message, [dynamic error, StackTrace? stackTrace]) {
if (kDebugMode) {
if (isLoggingEnabled) {
developer.log(message, name: 'Musadaq_Error', error: error, stackTrace: stackTrace);
}
}