v.1.0.18 dotenv for debug

This commit is contained in:
Tibor Bossanyi
2023-03-28 07:50:01 +02:00
parent 1c3310716c
commit 7a27a89397
3 changed files with 17 additions and 5 deletions
+11 -4
View File
@@ -1,17 +1,24 @@
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
// ignore: depend_on_referenced_packages
import 'package:intl/intl.dart';
mixin Logging {
void log(String message) {
if ( kDebugMode ) {
String debug = dotenv.get("debug", fallback: "0");
String? platformDebug = Platform.environment['debug'];
if (debug == "2") {
print("Debug-mode: $kDebugMode, dotenv: $debug, platform: $platformDebug");
}
if (kDebugMode || debug == "1" || platformDebug == "1") {
DateTime time = DateTime.now();
print(DateFormat('yyyy-MM-dd HH:mm:ss ').format(time) + message);
}
}
void trace(String message) {
if ( kDebugMode ) {
log(message);
}
log(message);
}
}