From 38212791717e4e108a4b4042e957b712c5396b8c Mon Sep 17 00:00:00 2001 From: Damon Date: Mon, 9 Dec 2019 14:13:37 +0800 Subject: [PATCH] =?UTF-8?q?U=20=E5=A2=9E=E5=8A=A0=E8=BE=93=E5=87=BA?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=E5=92=8C=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit U 增加输出方式和说明 --- HDWindowLoggerSwift.podspec | 2 +- HDWindowLoggerSwift.xcodeproj/project.pbxproj | 6 +- HDWindowLoggerSwift/AppDelegate.swift | 23 +-- .../HDWindowLoggerSwift.swift | 39 +++- HDWindowLoggerSwift/Info.plist | 21 --- HDWindowLoggerSwift/SceneDelegate.swift | 53 ------ HDWindowLoggerSwift/ViewController.swift | 2 + README.md | 177 ++++++++++++------ 8 files changed, 164 insertions(+), 159 deletions(-) delete mode 100644 HDWindowLoggerSwift/SceneDelegate.swift diff --git a/HDWindowLoggerSwift.podspec b/HDWindowLoggerSwift.podspec index b32a834..0b093b3 100644 --- a/HDWindowLoggerSwift.podspec +++ b/HDWindowLoggerSwift.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = 'HDWindowLoggerSwift' s.swift_version = '5.0' -s.version = '1.1.1' +s.version = '1.2.0' s.license= { :type => "MIT", :file => "LICENSE" } s.summary = 'The iOS side displays the output log log on the screen, and can generate log file sharing, which is convenient for debugging information' s.homepage = 'https://github.com/DamonHu/HDWindowLoggerSwift' diff --git a/HDWindowLoggerSwift.xcodeproj/project.pbxproj b/HDWindowLoggerSwift.xcodeproj/project.pbxproj index 529eb23..2645ce6 100644 --- a/HDWindowLoggerSwift.xcodeproj/project.pbxproj +++ b/HDWindowLoggerSwift.xcodeproj/project.pbxproj @@ -9,7 +9,6 @@ /* Begin PBXBuildFile section */ E4885A7122C60E5100B9BC8B /* LogContent.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4885A7022C60E5100B9BC8B /* LogContent.swift */; }; E48AABF722C05EF600CC5F1C /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E48AABF622C05EF600CC5F1C /* AppDelegate.swift */; }; - E48AABF922C05EF600CC5F1C /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E48AABF822C05EF600CC5F1C /* SceneDelegate.swift */; }; E48AABFB22C05EF600CC5F1C /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E48AABFA22C05EF600CC5F1C /* ViewController.swift */; }; E48AABFE22C05EF600CC5F1C /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E48AABFC22C05EF600CC5F1C /* Main.storyboard */; }; E48AAC0022C05EF700CC5F1C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E48AABFF22C05EF700CC5F1C /* Assets.xcassets */; }; @@ -42,7 +41,6 @@ E4885A7022C60E5100B9BC8B /* LogContent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogContent.swift; sourceTree = ""; }; E48AABF322C05EF600CC5F1C /* HDWindowLoggerSwift.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HDWindowLoggerSwift.app; sourceTree = BUILT_PRODUCTS_DIR; }; E48AABF622C05EF600CC5F1C /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; - E48AABF822C05EF600CC5F1C /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; E48AABFA22C05EF600CC5F1C /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; E48AABFD22C05EF600CC5F1C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; E48AABFF22C05EF700CC5F1C /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; @@ -112,7 +110,6 @@ children = ( E48AAC2622C05F0B00CC5F1C /* HDWindowLoggerSwift */, E48AABF622C05EF600CC5F1C /* AppDelegate.swift */, - E48AABF822C05EF600CC5F1C /* SceneDelegate.swift */, E48AABFA22C05EF600CC5F1C /* ViewController.swift */, E48AABFC22C05EF600CC5F1C /* Main.storyboard */, E48AABFF22C05EF700CC5F1C /* Assets.xcassets */, @@ -289,7 +286,6 @@ E48AABFB22C05EF600CC5F1C /* ViewController.swift in Sources */, E48AAC2822C05F5300CC5F1C /* HDWindowLoggerSwift.swift in Sources */, E48AABF722C05EF600CC5F1C /* AppDelegate.swift in Sources */, - E48AABF922C05EF600CC5F1C /* SceneDelegate.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -477,6 +473,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; INFOPLIST_FILE = HDWindowLoggerSwift/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -494,6 +491,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; INFOPLIST_FILE = HDWindowLoggerSwift/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", diff --git a/HDWindowLoggerSwift/AppDelegate.swift b/HDWindowLoggerSwift/AppDelegate.swift index 9e255db..e288885 100644 --- a/HDWindowLoggerSwift/AppDelegate.swift +++ b/HDWindowLoggerSwift/AppDelegate.swift @@ -11,31 +11,18 @@ import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { - + var window: UIWindow? func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { - // Override point for customization after application launch. + + let vc = ViewController() + self.window?.rootViewController = vc + self.window?.makeKeyAndVisible() return true } func applicationWillTerminate(_ application: UIApplication) { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } - - // MARK: UISceneSession Lifecycle - - func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { - // Called when a new scene session is being created. - // Use this method to select a configuration to create the new scene with. - return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) - } - - func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { - // Called when the user discards a scene session. - // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. - // Use this method to release any resources that were specific to the discarded scenes, as they will not return. - } - - } diff --git a/HDWindowLoggerSwift/HDWindowLoggerSwift/HDWindowLoggerSwift.swift b/HDWindowLoggerSwift/HDWindowLoggerSwift/HDWindowLoggerSwift.swift index 78630b1..e697f7b 100644 --- a/HDWindowLoggerSwift/HDWindowLoggerSwift/HDWindowLoggerSwift.swift +++ b/HDWindowLoggerSwift/HDWindowLoggerSwift/HDWindowLoggerSwift.swift @@ -9,16 +9,16 @@ import UIKit ///快速输出log -public func HDNormalLog(_ log:LogContent) -> Void { - HDWindowLoggerSwift.printLog(log: log.logStringValue, logType: HDLogType.kHDLogTypeNormal) +public func HDNormalLog(_ log:Any, file:String = #file, funcName:String = #function, lineNum:Int = #line) -> Void { + HDWindowLoggerSwift.printLog(log: log, logType: HDLogType.kHDLogTypeNormal, file:file, funcName:funcName, lineNum:lineNum) } -public func HDWarnLog(_ log:LogContent) -> Void { - HDWindowLoggerSwift.printLog(log: log.logStringValue, logType: HDLogType.kHDLogTypeWarn) +public func HDWarnLog(_ log:Any, file:String = #file, funcName:String = #function, lineNum:Int = #line) -> Void { + HDWindowLoggerSwift.printLog(log: log, logType: HDLogType.kHDLogTypeWarn, file:file, funcName:funcName, lineNum:lineNum) } -public func HDErrorLog(_ log:LogContent) -> Void { - HDWindowLoggerSwift.printLog(log: log.logStringValue, logType: HDLogType.kHDLogTypeError) +public func HDErrorLog(_ log:Any, file:String = #file, funcName:String = #function, lineNum:Int = #line) -> Void { + HDWindowLoggerSwift.printLog(log: log, logType: HDLogType.kHDLogTypeError, file:file, funcName:funcName, lineNum:lineNum) } ///log的级别,对应不同的颜色 @@ -47,6 +47,9 @@ public class HDWindowLoggerItem { ///log的输出 public class HDWindowLoggerSwift: UIWindow, UITableViewDataSource, UITableViewDelegate, UISearchBarDelegate { + public static var mCompleteLogOut = false //是否完整输出日志文件名等调试内容 + public static var mDebugAreaLogOut = true //是否在xcode底部的调试栏同步输出内容 + public static let defaultWindowLogger = HDWindowLoggerSwift(frame: CGRect(x: 0, y: UIApplication.shared.statusBarFrame.size.height, width: UIScreen.main.bounds.size.width, height: 300)) public private(set) var mLogDataArray = [HDWindowLoggerItem]() private var mFilterLogDataArray = [HDWindowLoggerItem]() @@ -322,7 +325,7 @@ public class HDWindowLoggerSwift: UIWindow, UITableViewDataSource, UITableViewDe private func p_getCurrentVC() -> UIViewController { var window = UIApplication.shared.keyWindow - if window?.windowLevel != UIWindow.Level.normal { + if window == nil || window?.windowLevel != UIWindow.Level.normal { let windowArray = UIApplication.shared.windows for tmpWin in windowArray { if tmpWin.windowLevel == UIWindow.Level.normal { @@ -358,7 +361,7 @@ public class HDWindowLoggerSwift: UIWindow, UITableViewDataSource, UITableViewDe /// 根据日志的输出类型去输出相应的日志,不同日志类型颜色不一样 /// - Parameter log: 日志内容 /// - Parameter logType: 日志类型 - public class func printLog(log:LogContent, logType:HDLogType) -> Void { + public class func printLog(log:Any, logType:HDLogType, file:String = #file, funcName:String = #function, lineNum:Int = #line) -> Void { if self.defaultWindowLogger.mLogDataArray.isEmpty { let loggerItem = HDWindowLoggerItem() loggerItem.mLogItemType = HDLogType.kHDLogTypeWarn @@ -369,7 +372,25 @@ public class HDWindowLoggerSwift: UIWindow, UITableViewDataSource, UITableViewDe let loggerItem = HDWindowLoggerItem() loggerItem.mLogItemType = logType loggerItem.mCreateDate = Date() - loggerItem.mLogContent = log.logStringValue + if self.mCompleteLogOut { + let fileName = (file as NSString).lastPathComponent; + if log is LogContent { + loggerItem.mLogContent = "[File:\(fileName)]:[Line:\(lineNum):[Function:\(funcName)]]-Log:\n" + (log as! LogContent).logStringValue + } else { + loggerItem.mLogContent = "[File:\(fileName)]:[Line:\(lineNum):[Function:\(funcName)]]-Log:\n\(log)" + } + } else { + if log is LogContent { + loggerItem.mLogContent = (log as! LogContent).logStringValue + } else { + loggerItem.mLogContent = "\(log)" + } + } + if self.mDebugAreaLogOut { + if let content = loggerItem.mLogContent { + print(content) + } + } self.defaultWindowLogger.mLogDataArray.append(loggerItem) if self.defaultWindowLogger.mMaxLogCount > 0 && self.defaultWindowLogger.mMaxLogCount > self.defaultWindowLogger.mMaxLogCount { self.defaultWindowLogger.mLogDataArray.removeFirst() diff --git a/HDWindowLoggerSwift/Info.plist b/HDWindowLoggerSwift/Info.plist index a20b6a3..af8868b 100644 --- a/HDWindowLoggerSwift/Info.plist +++ b/HDWindowLoggerSwift/Info.plist @@ -20,27 +20,6 @@ 1 LSRequiresIPhoneOS - UIApplicationSceneManifest - - UIApplicationSupportsMultipleScenes - - UISceneConfigurations - - UIWindowSceneSessionRoleApplication - - - UILaunchStoryboardName - LaunchScreen - UISceneConfigurationName - Default Configuration - UISceneDelegateClassName - $(PRODUCT_MODULE_NAME).SceneDelegate - UISceneStoryboardFile - Main - - - - UILaunchStoryboardName LaunchScreen UIMainStoryboardFile diff --git a/HDWindowLoggerSwift/SceneDelegate.swift b/HDWindowLoggerSwift/SceneDelegate.swift deleted file mode 100644 index 02f7342..0000000 --- a/HDWindowLoggerSwift/SceneDelegate.swift +++ /dev/null @@ -1,53 +0,0 @@ -// -// SceneDelegate.swift -// HDWindowLoggerSwift -// -// Created by Damon on 2019/6/24. -// Copyright © 2019 Damon. All rights reserved. -// - -import UIKit - -class SceneDelegate: UIResponder, UIWindowSceneDelegate { - - var window: UIWindow? - - - func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { - // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. - // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. - // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). - guard let _ = (scene as? UIWindowScene) else { return } - } - - func sceneDidDisconnect(_ scene: UIScene) { - // Called as the scene is being released by the system. - // This occurs shortly after the scene enters the background, or when its session is discarded. - // Release any resources associated with this scene that can be re-created the next time the scene connects. - // The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead). - } - - func sceneDidBecomeActive(_ scene: UIScene) { - // Called when the scene has moved from an inactive state to an active state. - // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. - } - - func sceneWillResignActive(_ scene: UIScene) { - // Called when the scene will move from an active state to an inactive state. - // This may occur due to temporary interruptions (ex. an incoming phone call). - } - - func sceneWillEnterForeground(_ scene: UIScene) { - // Called as the scene transitions from the background to the foreground. - // Use this method to undo the changes made on entering the background. - } - - func sceneDidEnterBackground(_ scene: UIScene) { - // Called as the scene transitions from the foreground to the background. - // Use this method to save data, release shared resources, and store enough scene-specific state information - // to restore the scene back to its current state. - } - - -} - diff --git a/HDWindowLoggerSwift/ViewController.swift b/HDWindowLoggerSwift/ViewController.swift index ed7943b..1cdcc69 100644 --- a/HDWindowLoggerSwift/ViewController.swift +++ b/HDWindowLoggerSwift/ViewController.swift @@ -20,6 +20,7 @@ class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() + self.view.backgroundColor = UIColor.white self.view.addSubview(self.clickButton) self.clickButton.addTarget(self, action: #selector(onClickButton), for: UIControl.Event.touchUpInside) } @@ -27,6 +28,7 @@ class ViewController: UIViewController { override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) HDWindowLoggerSwift.show() + HDWindowLoggerSwift.mCompleteLogOut = true HDNormalLog("收到就好丰盛的金凤凰就水电费交mmm换机时间开始的回复是砍价的回复四大皆空回复速度快解放后搜的飞机开会接口是点击开发还是手机打开混分巨兽地方收到就好丰盛的金凤凰就水电费交换机时间开始的回复是砍价的回复四大皆空回复速度快解放后搜的飞机开会接口是点击开发还是手机打开混分巨兽地方收到就好丰盛的金凤凰就水电费交换机时间开始的回复是砍价的回复四大皆空回复速度快解放后搜的飞机开会接口是点击开发还是手机打开混分巨兽地方") } diff --git a/README.md b/README.md index a44ea83..6698f48 100644 --- a/README.md +++ b/README.md @@ -43,78 +43,112 @@ You can drag the files in the `HDWindowLoggerSwift` folder into the project unde ## II. Use -Import header file +### 1、Import header file ``` Import HDWindowLoggerSwift ``` -### 2.1, then you can use the following functions as you like. -1, display the floating window +### 2、 display the floating window ``` HDWindowLoggerSwift.show() ``` -2, get the log information content +### 3 、 Print log content + +The font colors of the three output methods are different, and the corresponding types of printLog are different. ``` -HDWindowLoggerSwift.defaultWindowLogger.mLogDataArray +HDNormalLog (log) // Log's textColor is green + +HDWarnLog (log) // log's textColor is yellow + +HDErrorLog (log) // Log's textColor is red ``` -3, according to the output type of the log to output the corresponding log, different log types are not the same color +Output format + +``` +13: 45: 00.153> [ +  "1111111", +  "22222222", +  "sdjkhfsjkdfjkhsdhjfk", +  "3333sjdhgfhjg" +] ``` -HDWindowLoggerSwift.printLog(log: "mmmmmm", logType: HDLogType.kHDLogTypeNormal) -///The same effect can be achieved with a simple function. -HDNormalLog("mmmmmmm") +## III. more settings + +### 1、Set whether to output all information + +``` +HDWindowLoggerSwift.mCompleteLogOut = true ``` -4, delete the log +If set to output all debugging information, the output format is as follows, including the output file, the number of lines called, and the function called ``` -HDWindowLoggerSwift.cleanLog() +13: 51: 38.498> [File: ViewController.swift]: [Line: 41: [Function: onClickButton ()]]-Log: +[ +  "1111111", +  "22222222", +  "sdjkhfsjkdfjkhsdhjfk", +  "3333sjdhgfhjg" +] ``` -5, hide the entire log window +### 2、 Whether to output content synchronously in the debug bar at the bottom of xcode ``` -HDWindowLoggerSwift.hide() +HDWindowLoggerSwift.mDebugAreaLogOut = true ``` -6, only hide the log output window +### 3、Get the log information content ``` -HDWindowLoggerSwift.hideLogWindow() +HDWindowLoggerSwift.defaultWindowLogger.mLogDataArray ``` -7, set the log maximum number of records, the default 100, 0 is not limited +### 4、Clear the log ``` -HDWindowLoggerSwift.setMaxLogCount(logCount: 100) +HDWindowLoggerSwift.cleanLog() ``` -For the convenience of output, a three macro definition is encapsulated, corresponding to the different types of printLog. +### 5、hide the entire log window ``` -HDNormalLog(log) +HDWindowLoggerSwift.hide() +``` -HDWarnLog(log) +### 6、only hide the log output window -HDErrorLog(log) +``` +HDWindowLoggerSwift.hideLogWindow() ``` -### 2.1, use example +### 7、set the log maximum number of records, the default 100, 0 is not limited -The following two ways of using the output log are equivalent. +``` +HDWindowLoggerSwift.setMaxLogCount(logCount: 100) +``` + +### LogContent protocol + +If you want to customize the output content, you can integrate and use this type of `LogContent` protocol. For example, you can print the `URL` type to output only its` path`. You can directly set the returned `logStringValue`. ``` -HDWindowLoggerSwift.printLog(log: "mmmmmm", logType: HDLogType.kHDLogTypeNormal) -HDWarnLog("mmmmmmm") +extension URL: LogContent { +    public var logStringValue: String { +        return self.path +    } +} ``` -## III. Other instructions + +## IV. Other instructions 1. For the convenience of viewing, it is divided into three types: normal, warning and error. It corresponds to three different colors for easy viewing. 2. Click the corresponding cell to copy the output log directly to the system clipboard. @@ -150,78 +184,115 @@ pod 'HDWindowLoggerSwift' ## 二、使用 -导入头文件 +简单三步即可调用 + +### 1、导入头文件 ``` import HDWindowLoggerSwift ``` -### 2.1、然后可以根据示例随意使用以下功能 - -1、 显示悬浮窗 +### 2、显示悬浮窗 ``` HDWindowLoggerSwift.show() ``` -2、 获取log信息内容 +### 3、打印日志内容 + +三种输出方式字体颜色显示不同,对应的printLog不同的类型 ``` -HDWindowLoggerSwift.defaultWindowLogger.mLogDataArray +HDNormalLog(log) //日志为绿色 + +HDWarnLog(log) //日志为黄色 + +HDErrorLog(log) //日志为红色 ``` -3、根据日志的输出类型去输出相应的日志,不同日志类型颜色不一样 +输出格式 + +``` +13:45:00.153 > [ + "1111111", + "22222222", + "sdjkhfsjkdfjkhsdhjfk", + "3333sjdhgfhjg" +] ``` -HDWindowLoggerSwift.printLog(log: "mmmmmm", logType: HDLogType.kHDLogTypeNormal) -///使用简单函数也可以同样的效果 -HDNormalLog("mmmmmmm") +## 三、更多设置 + +通过其他设置可以实现获取更多内容 + +### 1、设置是否输出全部信息 + +``` +HDWindowLoggerSwift.mCompleteLogOut = true ``` -4、删除log +如果设置为输出全部调试信息,那么输出的格式是下面这样的,包含了输出文件、调用的行数、和调用的函数 ``` -HDWindowLoggerSwift.cleanLog() +13:51:38.498 > [File:ViewController.swift]:[Line:41:[Function:onClickButton()]]-Log: +[ + "1111111", + "22222222", + "sdjkhfsjkdfjkhsdhjfk", + "3333sjdhgfhjg" +] ``` -5、隐藏整个log窗口 +### 2、是否在xcode底部的调试栏同步输出内容 ``` -HDWindowLoggerSwift.hide() +HDWindowLoggerSwift.mDebugAreaLogOut = true ``` -6、仅隐藏log输出窗口 +### 3、 获取log信息内容 ``` -HDWindowLoggerSwift.hideLogWindow() +HDWindowLoggerSwift.defaultWindowLogger.mLogDataArray ``` -7、设置log最大记录数,默认100条,0为不限制 + +### 4、清空log ``` -HDWindowLoggerSwift.setMaxLogCount(logCount: 100) +HDWindowLoggerSwift.cleanLog() ``` -为了输出方便,封装了一个三个宏定义,对应的printLog不同的类型 +### 5、隐藏整个log窗口 ``` -HDNormalLog(log) +HDWindowLoggerSwift.hide() +``` -HDWarnLog(log) +### 6、仅隐藏log输出窗口 -HDErrorLog(log) +``` +HDWindowLoggerSwift.hideLogWindow() +``` + +### 7、设置log最大记录数,默认100条,0为不限制 + +``` +HDWindowLoggerSwift.setMaxLogCount(logCount: 100) ``` -### 2.1、使用示例 +### LogContent协议 -输出日志下面两种使用方式是等效的 +如果你想自定义输出的内容,可以集成并该类型的LogContent协议,例如设置打印`URL`类型只输出它的`path`,可以直接设置返回的`logStringValue`即可。 ``` -HDWindowLoggerSwift.printLog(log: "mmmmmm", logType: HDLogType.kHDLogTypeNormal) -HDWarnLog("mmmmmmm") +extension URL: LogContent { + public var logStringValue: String { + return self.path + } +} ``` -## 三、其他说明 +## 四、其他说明 1. 为了查看方便,分为普通、警告、错误三种类型,对应了三种不同的颜色,方便查看 2. 点击对应的cell可以直接将输出log复制到系统剪贴板