Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 40 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,45 @@ All notable changes to this project are documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

## [4.0.0]

### Added

- Network logging (opt-in): capture HTTP requests as `bf_network` logs for the Bugfender dashboard Network view.
- `Bugfender.SetNetworkLoggingEnabled`
- `Bugfender.SetNetworkLoggingCaptureBodies`
- `Bugfender.SetNetworkLoggingCaptureErrorResponseBodies`
- `Bugfender.SetNetworkLoggingRequestObfuscationHandler` / `SetNetworkLoggingResponseObfuscationHandler`
- `Bugfender.SetNetworkLoggingURLFilter`
- `Bugfender.SetNetworkLoggingMaxRequestsPerMinute`
- `Bugfender.LogNetwork` for custom HTTP stacks
- `BugfenderHttpMessageHandler` for `HttpClient`
- `BugfenderUnityWebRequest` helpers for `UnityWebRequest`
- Correlation headers `X-Bugfender-Session-ID` and `X-Bugfender-Request-ID` are injected on instrumented requests when network logging is enabled.
- Package Manager sample **Network Logging** (`Samples~/NetworkLogging`) demonstrating capture options, filters, rate limits, obfuscation, `HttpClient`, and `UnityWebRequest`.

### Changed

- Bump native Android SDK to `4.+` and add `android-okhttp:4.+`.
- Bump native iOS SDK SPM pin to `3.0.1`.
- Config APIs are forwarded to the native Android / iOS SDKs (OkHttp / URLSession traffic).
- SDK reports build version `40000` to the Bugfender backend.

### Compatibility

- **Unity:** 2022.3 or later (including Unity 6).
- **iOS:** Xcode 15+; Bugfender iOS SDK 3.0.1+.
- **Android:** Bugfender Android SDK 4.x + `android-okhttp` (pulled by this package).

### Documentation

- [Bugfender for Unity](https://docs.bugfender.com/docs/platforms/hybrid-platforms/bugfender-for-unity)
- [GitHub Releases](https://github.com/bugfender/BugfenderSDK-Unity/releases)

### Installation

See [README.md](README.md). Quick UPM (git URL): `https://github.com/bugfender/BugfenderSDK-Unity.git` — optional pin: `#v4.0.0`.

## [3.0.1]

### Added
Expand Down Expand Up @@ -35,5 +74,5 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

See [README.md](README.md). Quick UPM (git URL): `https://github.com/bugfender/BugfenderSDK-Unity.git` — optional pin: `#v3.0.1`.

[Unreleased]: https://github.com/bugfender/BugfenderSDK-Unity/compare/v3.0.1...HEAD
[4.0.0]: https://github.com/bugfender/BugfenderSDK-Unity/releases/tag/v4.0.0
[3.0.1]: https://github.com/bugfender/BugfenderSDK-Unity/releases/tag/v3.0.1
2 changes: 1 addition & 1 deletion Editor/IOSProjectBuildCustomizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static void OnPostprocessBuild(BuildTarget buildTarget, string pathToBuil
string mainTargetGuid = pbxProject.GetUnityMainTargetGuid();

// Get the remote package GUID
string packageGuid = pbxProject.AddRemotePackageReferenceAtVersionUpToNextMajor("https://github.com/bugfender/BugfenderSDK-iOS", "2.2.0");
string packageGuid = pbxProject.AddRemotePackageReferenceAtVersionUpToNextMajor("https://github.com/bugfender/BugfenderSDK-iOS", "3.0.1");

// Add the Remote Package to the Xcode project (both Unity framework and main target)
pbxProject.AddRemotePackageFrameworkToProject(pbxProject.GetUnityFrameworkTargetGuid(), "BugfenderLibrary", packageGuid, false /* required dependency */);
Expand Down
60 changes: 58 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,67 @@ You want the Bugfender SDK to initialize early to capture as many logs and error

You can change the priority in the **Project Settings** > **Script Execution Order**.

### Network logging

Network logging is **opt-in** and disabled by default. When enabled, HTTP requests can appear in the Bugfender dashboard as `bf_network` logs.

```csharp
Bugfender.SetNetworkLoggingEnabled(true);
// Optional:
Bugfender.SetNetworkLoggingCaptureBodies(false);
Bugfender.SetNetworkLoggingCaptureErrorResponseBodies(true);
Bugfender.SetNetworkLoggingURLFilter(
allowlist: new[] { "https://api.example.com/*" },
denylist: new[] { "*/secrets/*" });
Bugfender.SetNetworkLoggingMaxRequestsPerMinute(60);

// Redact secrets before logs are sent (also applied to native OkHttp / URLSession capture):
Bugfender.SetNetworkLoggingRequestObfuscationHandler((url, headers, body) =>
{
if (headers.ContainsKey("Authorization"))
{
headers["Authorization"] = "***";
}
return new NetworkRequestData(url, headers, body);
});
Bugfender.SetNetworkLoggingResponseObfuscationHandler((headers, body) =>
{
return new NetworkResponseData(headers, body);
});
```

Unity does not have a single global HTTP stack. Instrument traffic with one of:

**`HttpClient`** — wrap with `BugfenderHttpMessageHandler`:

```csharp
var client = new HttpClient(new BugfenderHttpMessageHandler());
var response = await client.GetAsync("https://api.example.com/users");
```

**`UnityWebRequest`** — use the helpers:

```csharp
var request = UnityWebRequest.Get("https://api.example.com/users");
yield return BugfenderUnityWebRequest.Send(request);
```

Or manually: `BugfenderUnityWebRequest.Prepare(request)` before send, then `Complete(...)` after.

**Other HTTP libraries** — build a `NetworkLogEntry` and call `Bugfender.LogNetwork(entry)`.

When network logging is enabled, instrumented requests also receive correlation headers:
`X-Bugfender-Session-ID` and `X-Bugfender-Request-ID`.

On Android/iOS the same config APIs (including obfuscation handlers) are forwarded to the native SDKs (OkHttp / URLSession). Typical Unity game traffic still needs the C# helpers above. Android ships `android-okhttp`; native OkHttp clients must add `BugfenderOkHttpInterceptor` (and optionally `BugfenderOkHttpEventListenerFactory`) themselves.

### Adjust the native Bugfender SDK versions
This package imports the native Bugfender SDKs for iOS and Android using Swift Package Manager and Gradle.

By default, the latest compatible versions are used. If you would like to tweak that, you can fork this project and edit these files:

* For iOS: `Editor/IOSProjectBuildCustomizer.cs`
* For Android: `Runtime/Plugins/Android/Bugfender.androidlib/build.gradle`
* For iOS: `Editor/IOSProjectBuildCustomizer.cs` (SPM `3.0.1`+)
* For Android: `Runtime/Plugins/Android/Bugfender.androidlib/build.gradle` (`com.bugfender.sdk:android:4.+` and `android-okhttp:4.+`)

## Changelog

Expand All @@ -38,5 +92,7 @@ See [CHANGELOG.md](CHANGELOG.md) for version history.
## Example project
Check out this project to see Bugfender in action: https://github.com/bugfender/unity-demo

This package also includes a **Network Logging** sample (Package Manager → Bugfender → Samples) that configures capture, filters, rate limits, and obfuscation handlers for `HttpClient` and `UnityWebRequest`.

## Testing
See `TESTING.md` for a manual validation checklist for Unity import, Android builds, iOS builds, and runtime verification.
Loading