1
0
Fork 0

Finish to add configuration tutorial

This commit is contained in:
Florian RICHER (MrDev023) 2022-03-31 21:34:28 +02:00
parent a3b25c3ee1
commit 4e8fd12fdc
9 changed files with 236 additions and 39 deletions

30
lib/utils/logger.dart Normal file
View file

@ -0,0 +1,30 @@
import 'package:flutter/foundation.dart';
enum LoggerType { info, warning, error }
class Logger {
static void log(LoggerType logType, Object? instance, String message) {
if (kDebugMode) {
String className;
if (instance is Type) {
className = instance.toString();
} else {
className = instance?.runtimeType.toString() ?? 'GLOBAL';
}
String cat;
switch (logType) {
case LoggerType.info:
cat = 'INFO';
break;
case LoggerType.warning:
cat = 'WARNING';
break;
case LoggerType.error:
cat = 'ERROR';
break;
}
// ignore: avoid_print
print('[$cat][$className] $message');
}
}
}