Skip to content

The iOS side displays the output log log on the screen, and can generate log file sharing, which is convenient for debugging information when the real machine is not connected to xcode. iOS端将输出日志log悬浮显示在屏幕上,可以生成日志文件分享,便于在真机没有连接xcode的情况下调试信息

License

Notifications You must be signed in to change notification settings

DamonHu/DDLoggerSwift

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DDLoggerSwift

DDLoggerSwift is an iOS library that displays log output as a floating overlay on the screen. It allows easy logging and supports log file sharing and uploading, making it convenient for debugging on a real device without an Xcode connection. Users can share and filter logs effortlessly.

This project uses SQLite for efficient log storage while ensuring insertion order. It does not affect UI performance or interactions, ensuring high runtime efficiency.Automatically converts Array and Dictionary into JSON strings for display.

Preview GIF picture Xcode debug GIF

1. Installation

You can install DDLoggerSwift using CocoaPods or manually by downloading the source files and adding them to your project.

1.1 CocoaPods Installation

Add the following line to your Podfile and run pod install:

pod 'DDLoggerSwift'

1.2 Manual Installation

Drag and drop the files from the pod folder into your project.


2. Usage

1. Import the Framework

import DDLoggerSwift

2. Show the Floating Log Window

DDLoggerSwift.show()

3. Log Output

There are five types of log outputs, each with different font colors.

printDebug(log)   // Debug output, only visible in Xcode, not stored in the log database.

printLog(log)     // Logs displayed in green.

printWarn(log)    // Logs displayed in yellow.

printError(log)   // Logs displayed in red.

printPrivacy(log) // Outputs encrypted data. Encryption details can be found in the encryption documentation.

4. Log Output Format

✅ [2025-03-19T03:11:59Z] [INFO] File: TalkViewModel.swift | Line: 730 | Function: _bindRequest() |
---------------------------------
Log message

⚠️ [2025-03-19T03:11:59Z] [WARN] File: TalkViewModel.swift | Line: 730 | Function: _bindRequest() |
---------------------------------
Warning message

❌ [2025-03-19T03:11:59Z] [ERROR] File: TalkViewModel.swift | Line: 730 | Function: _bindRequest() |
---------------------------------
Error message

⛔️ [2025-03-19T03:11:59Z] [PRIVACY] File: TalkViewModel.swift | Line: 730 | Function: _bindRequest() |
---------------------------------
AAuKjIm5hC2jiPqz7OKHAngWspeACyWZufDguqdOcugituhWV8jnbr/6SHYoK0/9

💜 [2025-03-19T03:11:59Z] [DEBUG] File: TalkViewModel.swift | Line: 730 | Function: _bindRequest() |
---------------------------------
Test output, not stored in the database by default.

III. Advanced Usage

For advanced features such as file encryption, custom formats, file retrieval, and sharing, please refer to the wiki for a complete list and detailed instructions.

Wiki

IV. Log viewing client

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.

local network real-time log

After the 3.0.0 version, it can be used with the above log viewing tool to realize real-time log viewing on the local area network, and use the simple configuration interface

For local network real-time log viewing, refer to Log Viewing Client.

License

The project is based on the MIT License

About

The iOS side displays the output log log on the screen, and can generate log file sharing, which is convenient for debugging information when the real machine is not connected to xcode. iOS端将输出日志log悬浮显示在屏幕上,可以生成日志文件分享,便于在真机没有连接xcode的情况下调试信息

Topics

Resources

License

Stars

Watchers

Forks