An open source log system for Objective-C based on Xcodecolors and KZLinkedConsole.
中文请下翻
This library requires a deployment target of iOS 6.0 or greater.
It takes as little as a single line of code to configure CATLog when your application launches.Then replace your NSLog statements with CATLog[X] statements and that's about it.
- Log level
- Log file
- Log crash
- Colorizing debugger console outp
- Clickable links in your Xcode console, so you never wonder which class logged the message.
Clickable links in your Xcode console,like this.
pod 'CATLog'
Alternatively you can directly add the CATLog.h
& CATLog.m
source files to your project.
1.Install Xcodecolors by Alcatraz
2.Install KZLinkedConsole by Alcatraz
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
//Set ExceptionHandler
NSSetUncaughtExceptionHandler(&uncaughtExceptionHandler);
//Init log
[CATLog initLog];
//Log normal string
CLogE(@"test normal string");
NSString* normalStt = [NSString stringWithFormat:@"Normal String"];
CLogE(normalStt);
//Log format string
CLogD(@"string1,%@,%@",@"string2",@"string3");
UIImageView* imgView = [[UIImageView alloc]init];
CLogD(@"format string %@",imgView);
return YES;
}
void uncaughtExceptionHandler(NSException *exception){
[CATLog logCrash:exception];
}
一个基于Xcodecolors和KZLinkedConsole的oc开源日志工具
iOS6或以上
只需加入几行代码就可配置完毕。然后将NSLog换成CATLog[X] 就可以了。
- 支持设置日志级别
- 支持日志输出到文件
- 支持日志记录Crash信息
- 支持颜色打印日志
- 支持点击日志信息跳转到代码中,方便定位错误信息。
pod 'CATLog'
直接拖拽 CATLog.h
& CATLog.m
到工程中即可。
1.先通过Alcatraz安装Xcodecolors
2.再安装 KZLinkedConsole
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
//Set ExceptionHandler
NSSetUncaughtExceptionHandler(&uncaughtExceptionHandler);
//Init log
[CATLog initLog];
//Log normal string
CLogE(@"test normal string");
NSString* normalStt = [NSString stringWithFormat:@"Normal String"];
CLogE(normalStt);
//Log format string
CLogD(@"string1,%@,%@",@"string2",@"string3");
UIImageView* imgView = [[UIImageView alloc]init];
CLogD(@"format string %@",imgView);
return YES;
}
void uncaughtExceptionHandler(NSException *exception){
[CATLog logCrash:exception];
}