25 lines
698 B
Dart
25 lines
698 B
Dart
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) {
|
|
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) {
|
|
log(message);
|
|
}
|
|
}
|