Skip to content

5. Log Viewing Client

Damon东哥 edited this page Mar 25, 2025 · 4 revisions

This library stores log information using SQLite. You can use any generic SQLite viewer or the DDLoggerClient client to view the SQLite files exported by DDLoggerSwift.

The client is developed using SwiftUI and is specifically designed to parse logs from DDLoggerSwift, making log viewing more convenient.

Real-time Log Viewing via Local Network (deprecated)

**⚠️ This feature has been deprecated due to privacy and security concerns. If you need this feature, you can refer to versions prior to 5.2.0 or customize the transmission functionality by retrieving all logs. The old version uses Bonjour broadcasting and websocket for LAN transmission of logs. **

Starting from version 3.0.0, real-time log viewing over a local network has been implemented, allowing easy configuration and usage.

1. Enable Local Network Logging in Your Project

Add the following pod to your project:

pod 'DDLoggerSwift/socket'

2. Configure info.plist for Local Network and Bonjour Services

Add the following keys to your info.plist file:

<key>NSBonjourServices</key>
	<array>
		<string>_DDLoggerSwift._tcp</string>
	</array>
<key>NSLocalNetworkUsageDescription</key>
<string>Search for local network to enable Bonjour functionality</string>

Note: The type value in NSBonjourServices must match the DDLoggerSwift.socketType. You can customize socketType in DDLoggerSwift, but if you modify it, ensure that info.plist reflects the same change.

With this configuration, you can view logs from devices on the same local network using DDLoggerClient without any additional setup.