π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Refine log filtering for isolate output
Priyanshu Dangare4f2e1718a071
diff --git a/mobile/apps/photos/lib/core/error-reporting/isolate_logging.dart b/mobile/apps/photos/lib/core/error-reporting/isolate_logging.dartindex 0377f3a36e..76a4f7e8da 100644--- a/mobile/apps/photos/lib/core/error-reporting/isolate_logging.dart+++ b/mobile/apps/photos/lib/core/error-reporting/isolate_logging.dart@@ -57,12 +57,12 @@ class IsolateLogger {final Queue<IsolateLogString> fileQueueEntries = Queue();Future onLogRecordInIsolate(LogRecord rec) async {- if (!SuperLogging.shouldLogRecord(rec)) return;-final str = rec.toPrettyString(null, true);// write to stdout- SuperLogging.printLog(str);+ if (SuperLogging.shouldPrintLogRecord(rec)) {+ SuperLogging.printLog(str);+ }// push to log queuefileQueueEntries.add(diff --git a/mobile/apps/photos/lib/core/error-reporting/super_logging.dart b/mobile/apps/photos/lib/core/error-reporting/super_logging.dartindex 0063ce984e..111123fa4e 100644--- a/mobile/apps/photos/lib/core/error-reporting/super_logging.dart+++ b/mobile/apps/photos/lib/core/error-reporting/super_logging.dart@@ -412,7 +412,9 @@ class SuperLogging {static String _lastExtraLines = '';- static final Level rootLoggerLevel =+ static const Level rootLoggerLevel = kDebugMode ? Level.ALL : Level.INFO;++ static final Level _terminalLoggerLevel =Level.LEVELS.where((level) =>@@ -422,16 +424,16 @@ class SuperLogging {).trim().toLowerCase(),).firstOrNull ??- (kDebugMode ? Level.ALL : Level.INFO);+ rootLoggerLevel;- static bool shouldLogRecord(LogRecord rec) {- return _loggerPrefixDefine.isEmpty ||+ static bool shouldPrintLogRecord(LogRecord rec) {+ final matchesPrefix =+ _loggerPrefixDefine.isEmpty ||rec.loggerName.toLowerCase().startsWith(_loggerPrefixDefine);+ return matchesPrefix && rec.level.value >= _terminalLoggerLevel.value;}static Future onLogRecord(LogRecord rec) async {- if (!shouldLogRecord(rec)) return;-// log misc info if it changedString? extraLines = "app version: '$appVersion'\n";if (extraLines != _lastExtraLines) {@@ -443,7 +445,9 @@ class SuperLogging {final str = (config.prefix) + " " + rec.toPrettyString(extraLines);// write to stdout- printLog(str);+ if (shouldPrintLogRecord(rec)) {+ printLog(str);+ }saveLogString(str, rec.error, rec: rec);}