Repository: beeware/briefcase

Issue:
macOS/iOS log filter strips content inside `[]`
### Describe the bug

When running a macOS/iOS app, Briefcase applies a filter to strip unnecessary detail from the log. However, the log filter is a little *too* hungry - it strips all content up to the first closing brace.

### Steps to reproduce

1. Create a hello world app for macOS or iOS
2. add `print("This is a test [1 / 5] of the filter")`
3. Run the app (`briefcase run`)

The logged output will be
```
of the filter
```



### Expected behavior

The logged content should be 
```
This is a test [1 / 5] of the filter
```

### Screenshots

_No response_

### Environment

- Operating System: macOS, iOS
- Python version: all
- Software versions:
  - Briefcase: 0.3.14


### Logs

```

```


### Additional context

The regex capturing the process ID is being too greedy.

Discussion:

Patch:
diff --git a/changes/1179.bugfix.rst b/changes/1179.bugfix.rst
new file mode 100644
index 00000000..e8e44aaa
--- /dev/null
+++ b/changes/1179.bugfix.rst
@@ -0,0 +1,1 @@
+Content before a closing square bracket (``]``) or ``.so)`` is no longer stripped by the macOS and iOS log filter.
diff --git a/src/briefcase/platforms/macOS/__init__.py b/src/briefcase/platforms/macOS/__init__.py
index 9df8afde..76cd9237 100644
--- a/src/briefcase/platforms/macOS/__init__.py
+++ b/src/briefcase/platforms/macOS/__init__.py
@@ -28,8 +28,8 @@ DEFAULT_OUTPUT_FORMAT = "app"
 
 
 MACOS_LOG_PREFIX_REGEX = re.compile(
-    r"\d{4}-\d{2}-\d{2} (?P<timestamp>\d{2}:\d{2}:\d{2}.\d{3}) Df (.*?)\[.*?:.*\]"
-    r"(?P<subsystem>( \(libffi\.dylib\))|( \(_ctypes\.cpython-3\d{1,2}-.*\.so\)))? (?P<content>.*)"
+    r"\d{4}-\d{2}-\d{2} (?P<timestamp>\d{2}:\d{2}:\d{2}.\d{3}) Df (.*?)\[.*?:.*?\]"
+    r"(?P<subsystem>( \(libffi\.dylib\))|( \(_ctypes\.cpython-3\d{1,2}-.*?\.so\)))? (?P<content>.*)"
 )
 
 


Test patch:
diff --git a/tests/platforms/macOS/test_macOS_log_clean_filter.py b/tests/platforms/macOS/test_macOS_log_clean_filter.py
index 9b536044..afc556f1 100644
--- a/tests/platforms/macOS/test_macOS_log_clean_filter.py
+++ b/tests/platforms/macOS/test_macOS_log_clean_filter.py
@@ -72,6 +72,17 @@ from briefcase.platforms.macOS import macOS_log_clean_filter
             "This doesn't match the regex",
             ("This doesn't match the regex", False),
         ),
+        # Log content that contains square brackets
+        (
+            "2022-11-14 13:21:15.341 Df My App[59972:780a15] (libffi.dylib) Test [1/5] ... OK",
+            ("Test [1/5] ... OK", True),
+        ),
+        # Log content that contains `.so`
+        (
+            "2022-11-14 13:21:15.341 Df My App[59972:780a15] (_ctypes.cpython-312-iphonesimulator.so) "
+            "A problem (foo.so) try to avoid it",
+            ("A problem (foo.so) try to avoid it", True),
+        ),
     ],
 )
 def test_filter(original, filtered):