Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Clean up

Neeraj Gupta936c6f1b6117
diff --git a/mobile/apps/photos/lib/core/error-reporting/super_logging.dart b/mobile/apps/photos/lib/core/error-reporting/super_logging.dart
index 13cc1cace5..90809cebf3 100644
--- a/mobile/apps/photos/lib/core/error-reporting/super_logging.dart
+++ b/mobile/apps/photos/lib/core/error-reporting/super_logging.dart
@@ -189,6 +189,15 @@ class SuperLogging {
Logger.root.level = kDebugMode ? Level.ALL : Level.INFO;
Logger.root.onRecord.listen(onLogRecord);
+ if (_preferences.getBool("enable_db_logging") ?? kDebugMode) {
+ try {
+ await LogViewer.initialize(prefix: appConfig.prefix);
+ $.info("Log viewer initialized successfully");
+ } catch (e) {
+ $.warning("Failed to initialize log viewer: $e");
+ }
+ }
+
if (isFDroidClient) {
assert(
sentryIsEnabled == false,
@@ -219,19 +228,6 @@ class SuperLogging {
}),
);
- // Initialize log viewer integration in debug mode
- // Initialize log viewer in debug mode only
- if (_preferences.getBool("enable_db_logging") ?? kDebugMode) {
- try {
- await LogViewer.initialize();
- // Register LogViewer with SuperLogging to receive logs with process prefix
- LogViewer.registerWithSuperLogging(SuperLogging.registerLogCallback);
- $.info("Log viewer initialized successfully");
- } catch (e) {
- $.warning("Failed to initialize log viewer: $e");
- }
- }
-
if (appConfig.body == null) return;
if (enable && sentryIsEnabled) {
@@ -311,17 +307,6 @@ class SuperLogging {
printLog(str);
saveLogString(str, rec.error);
- // Hook for external log viewer (if available)
- // This allows the log_viewer package to capture logs without creating a dependency
- if(_logViewerCallback != null) {
- try {
- if (_logViewerCallback != null) {
- _logViewerCallback!(rec, config.prefix);
- }
- } catch (_) {
- // Silently ignore any errors from the log viewer
- }
- }
}
static void saveLogString(String str, Object? error) {
@@ -339,15 +324,6 @@ class SuperLogging {
}
}
- // Callback that can be set by external packages (like log_viewer)
- static void Function(LogRecord, String)? _logViewerCallback;
-
- /// Register a callback to receive log records
- /// This is used by the log_viewer package to capture logs
- static void registerLogCallback(void Function(LogRecord, String) callback) {
- _logViewerCallback = callback;
- }
-
static final Queue<String> fileQueueEntries = Queue();
static bool isFlushing = false;
diff --git a/mobile/apps/photos/pubspec.lock b/mobile/apps/photos/pubspec.lock
index bc4d4cf1d1..25c1d1af0b 100644
--- a/mobile/apps/photos/pubspec.lock
+++ b/mobile/apps/photos/pubspec.lock
@@ -2147,6 +2147,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.5.0"
+ qr:
+ dependency: transitive
+ description:
+ name: qr
+ sha256: "5a1d2586170e172b8a8c8470bbbffd5eb0cd38a66c0d77155ea138d3af3a4445"
+ url: "https://pub.dev"
+ source: hosted
+ version: "3.0.2"
+ qr_flutter:
+ dependency: "direct main"
+ description:
+ name: qr_flutter
+ sha256: "5095f0fc6e3f71d08adef8feccc8cea4f12eec18a2e31c2e8d82cb6019f4b097"
+ url: "https://pub.dev"
+ source: hosted
+ version: "4.1.0"
quiver:
dependency: transitive
description:
diff --git a/mobile/packages/log_viewer/example_logger_filter.md b/mobile/packages/log_viewer/example_logger_filter.md
new file mode 100644
index 0000000000..13230eedd2
--- /dev/null
+++ b/mobile/packages/log_viewer/example_logger_filter.md
@@ -0,0 +1,40 @@
+# Logger Filter Feature Usage
+
+The log viewer now supports filtering logs by logger names directly through the search box, without any UI changes.
+
+## Search Syntax
+
+### Basic Logger Filtering
+- `logger:AuthService` - Shows only logs from the AuthService logger
+- `logger:UserService` - Shows only logs from the UserService logger
+
+### Wildcard Support
+- `logger:Auth*` - Shows logs from all loggers starting with "Auth" (e.g., AuthService, Authentication, AuthManager)
+- `logger:*Service` - Not supported yet (only prefix wildcards are supported)
+
+### Combined Search
+- `logger:AuthService error` - Shows logs from AuthService that contain "error" in the message
+- `login logger:UserService` - Shows logs from UserService that contain "login"
+- `logger:Auth* failed` - Shows logs from loggers starting with "Auth" that contain "failed"
+
+## Quick Access from Analytics
+
+1. Navigate to Logger Analytics (via the menu in the log viewer)
+2. Tap on any logger name card
+3. The log viewer will automatically populate the search box with `logger:LoggerName` and filter the logs
+
+## Implementation Details
+
+- The search box hint text now shows "Search logs or use logger:name..."
+- When logger: syntax is detected, it's parsed and converted to logger filters
+- The remaining text (after removing logger: patterns) is used for message search
+- Multiple logger patterns can be used: `logger:Auth* logger:User*`
+- Clearing the search box removes all filters
+
+## Benefits
+
+1. **No UI Changes**: The existing search box is enhanced with new functionality
+2. **Intuitive Syntax**: Similar to GitHub and Google search operators
+3. **Quick Navigation**: Tap logger names in analytics to instantly filter
+4. **Powerful Combinations**: Mix logger filters with text search
+5. **Wildcard Support**: Filter multiple related loggers with prefix patterns
\ No newline at end of file