Erweiterungen
This commit is contained in:
1 parent
88dc13391d
commit
75787d51ff
6 files changed
+731
-5
No files matched your search
@@ -6,7 +6,9 @@ import 'package:flutter/services.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
import 'package:package_info/package_info.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:stadtbote/main.dart';
|
||||
import 'package:stadtbote/model/job.dart';
|
||||
import 'package:stadtbote/model/log_entry.dart';
|
||||
import 'package:stadtbote/tools/constants.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
@@ -83,12 +85,34 @@ class Util {
|
||||
final pattern = RegExp('.{1,800}'); // 800 is the size of each chunk
|
||||
pattern.allMatches(text).forEach((match) => debugPrint(match.group(0)));
|
||||
}
|
||||
|
||||
static void _persistLogMessage(String text, LogEntrySeverityEnum severity) {
|
||||
var logEntry = LogEntry();
|
||||
logEntry.time = DateTime.now();
|
||||
logEntry.text = text;
|
||||
logEntry.severity = severity;
|
||||
|
||||
MyApp.isarInstance.writeTxnSync(() {
|
||||
MyApp.isarInstance.logEntrys.putSync(logEntry);
|
||||
});
|
||||
}
|
||||
|
||||
static logInfo(String message) {
|
||||
_printLongText(message);
|
||||
|
||||
_persistLogMessage(message, LogEntrySeverityEnum.info);
|
||||
}
|
||||
|
||||
static logDebug(String message) {
|
||||
_printLongText(message);
|
||||
|
||||
_persistLogMessage(message, LogEntrySeverityEnum.debug);
|
||||
}
|
||||
|
||||
static logException(String message) {
|
||||
_printLongText(message);
|
||||
|
||||
_persistLogMessage(message, LogEntrySeverityEnum.error);
|
||||
}
|
||||
|
||||
static int fastHash(String string) {
|
||||
|
||||
Reference in new issue
Block a user