SwiftyLog 0.3.3

SwiftyLog 0.3.3

唐志辉 维护。



SwiftyLog 0.3.3

  • 唐志辉

SwiftyLog

License Platform Carthage Compatible Cocoapods Compatible CI Status

SwiftyLog 是一个优雅地记录日志的工具。您也可以通过摇晃设备将日志发送到指定的电子邮件地址。易于使用

1. 示例

要运行示例项目,请克隆仓库,然后在 Xcode 中运行“Example”目标。

2. 系统要求

Xcode: 9.0

iOS: 9.0

3. 安装

SwiftyLog 可通过 CocoaPods 或 Carthage 获得。

3.1 CocoaPods

要安装它,只需将以下行添加到您的 Podfile 中

pod 'SwiftyLog'
# or
# pod 'SwiftyLog', :git => 'https://github.com/zhihuitang/SwiftyLog.git'

请添加以下内容到Cartfile

然后从命令行执行carthage update

github "https://github.com/zhihuitang/SwiftyLog.git"

4. 使用方法

$ carthage update

输出

import SwiftyLog

let logger = Logger.shared

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
		
        // Disabled by default
        // Logger.shared.level = .none
        logger.level = .info
        logger.showThread = true
        logger.ouput = .debugerConsoleAndFile
        
        logger.d("Application started")
        // logger.i("information log")
        // logger.e("error log")
        // logger.d("debug log")
        // logger.w("warning log")

        return true
    }

}

通过摇晃设备查看日志

2018-01-13T21:20:46.149Z 💚d-<NSThread: 0x1c0261dc0>{number = 1, name = main}[AppDelegate.swift#application(_:didFinishLaunchingWithOptions:)#26]: Application started

强烈建议

摇晃您的设备以在测试iPhone上查看日志。在该页面中,您还可以点击按钮发送邮件,将日志文件发送到指定的邮箱。

5. 作者

Zhihui Tang, [email protected]

6. 许可证

SwiftyLog根据MIT许可证提供。更多信息请参阅LICENSE文件。