v.1.0.18 dotenv for debug
This commit is contained in:
+11
-4
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user