microLogger
轻量级的 Swift 日志记录器
安装
使用 Cocoapods 安装此易于使用的日志记录器。
pod 'microLogger', '~> 1.0.0'
用法
导入模块
import MicroLogger
设置日志级别
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
MLogger.logLevel = .debug
return true
}
或者更好的是
#if DEBUG
MLogger.logLevel = .verbose
#else
MLogger.logLevel = .error // you don't have to worry about logging embarrassing verbose messages in production
#endif
记录所有内容!
MLogger.logWarning(sender: self,
andMessage: "This should not happen.")