Code Monkey home page Code Monkey logo

catlog's Introduction

CATLog

pod

An open source log system for Objective-C based on Xcodecolors and KZLinkedConsole.

中文请下翻

Requirements

This library requires a deployment target of iOS 6.0 or greater.

Features

CATLog is Simple:

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.

CATLog is Powerful:

  • 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.

Effect

effect

Clickable links in your Xcode console,like this.

Adding CATLog to your project

Pod

pod 'CATLog'

Source files

Alternatively you can directly add the CATLog.h& CATLog.m source files to your project.

Usage

1.Install Xcodecolors by Alcatraz

Xcodecolors

KZLinkedConsole

3.Code

- (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];
}

CATLog

effect

一个基于XcodecolorsKZLinkedConsole的oc开源日志工具

Requirements

iOS6或以上

特性

CATLog 使用简单:

只需加入几行代码就可配置完毕。然后将NSLog换成CATLog[X] 就可以了。

CATLog 功能强大:

  • 支持设置日志级别
  • 支持日志输出到文件
  • 支持日志记录Crash信息
  • 支持颜色打印日志
  • 支持点击日志信息跳转到代码中,方便定位错误信息。

效果

effect

点击日志信息跳转到代码中的效果如下。

将CATLog加入工程

使用Pod

pod 'CATLog'

使用源码

直接拖拽 CATLog.h& CATLog.m 到工程中即可。

使用说明

1.先通过Alcatraz安装Xcodecolors

Xcodecolors

2.再安装 KZLinkedConsole

KZLinkedConsole

3.编码

- (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];
}

catlog's People

Contributors

catchzeng avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.