LibLoggerPod 1.0

LibLoggerPod 1.0

测试已测试
语言语言 Obj-CObjective C
许可证 MIT
发布最新发布2016年9月

Scott Richards维护。



  • 编者:
  • Scott Richards

概述

追踪二进制图像加载。创建所有加载的动态库的日志。

示例

要运行示例项目,首先克隆仓库,然后在 Example 目录下运行 pod install。此示例是用 Objective C 编写的。要保存日志,请调用 writeLog() 以访问日志,并调用最后日志 lastLog()。以下是一个缩略的日志示例:

Library Loading Log Started: 2016-09-26 08:30:42 -0700
Loaded: 0x10e1f9000 /Users/scottrichards/Library/Developer/CoreSimulator/Devices/DC414095-3DDB-44F3-BC57-6FEA102C00C7/data/Containers/Bundle/Application/9C101138-F63F-4B29-9FCC-88AB4663F227/LibLoggerPod_Example.app/LibLoggerPod_Example
...
Library Loading Log Completed: 2016-09-26 08:30:52 

要求

这个 Cocoapod 库是用 Objective C 编写的。它是用 XCode 7.3 编译和测试的。我也在 Swift 应用和 ObjectiveC 应用中测试过它。

安装

LibLoggerPod 可以作为一个 CocoaPod 获取。要安装它,只需将以下行添加到你的 Podfile 中,指定路径到 CocoaPod

pod "LibLoggerPod", :path => '../'

用法

Swift

向包含文件中添加以下内容

import <LibLoggerPod>

要输出日志调用 LibraryLogger.writeLog(),您需要在应用程序退出前调用它(可以多次调用,它将仅重写日志和任何额外的日志信息)。您可能希望在 AppDelegate 的 applicationWillResignActive 或 applicationDidEnterBackground 方法中添加对此的调用。

Swift 中写入日志

func applicationWillResignActive(application: UIApplication) {
  LibraryLogger.writeLog()
}

要获取最后日志调用:LibraryLogger.lastLog() 例如在 Swift 中

logTextView.text = LibraryLogger.lastLog()

Objective C

对于 Objective C,向包含文件中添加以下内容

#import "LibraryLogger.h"

要获取最后日志调用:[LibraryLogger lastLog] 例如在 Objective C 中:Swift

self.logTextView.text = [LibraryLogger lastLog];

要输出日志调用 [LibraryLogger writeLog],您需要在应用程序退出前调用它(可以多次调用,它将仅重写日志和任何额外的日志信息)。您可能希望在 AppDelegate 的 applicationWillResignActive 或 applicationDidEnterBackground 方法中添加对此的调用。

- (void)applicationWillResignActive:(UIApplication *)application
{
    [LibraryLogger writeLog];
}

作者

Scott Richards, [email protected]

许可证

LibLoggerPod遵守MIT许可协议。有关更多信息,请参阅LICENSE文件。