diff --git a/README.md b/README.md index e767aa7..47150b9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,8 @@ Workout Test and Diet 4 You Common Util Functions + +Version 1.0.18 +debug by dotenv + Version 1.0.17 Webapi remove http.get utf8 decode diff --git a/lib/util/logging.dart b/lib/util/logging.dart index 3d4cd4d..2d139a0 100644 --- a/lib/util/logging.dart +++ b/lib/util/logging.dart @@ -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); } } diff --git a/pubspec.yaml b/pubspec.yaml index 4b03b43..9abf021 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: workouttest_util description: Workout Test app and web functions. -version: 1.0.17 +version: 1.0.18 environment: sdk: ">=2.18.6 <3.0.0" @@ -18,6 +18,7 @@ dependencies: firebase_messaging: ^14.2.1 firebase_remote_config: ^3.0.9 flutter_facebook_auth: ^5.0.7 + flutter_dotenv: ^5.0.2 google_sign_in: ^5.4.3 http: ^0.13.5