Coder Social home page Coder Social logo

wplogoutputer's Introduction

WPLogOutputer

##离线日志打印神器,调试神器 是否遇到过在Xcode未跑起来,直接在真机上调试但是此刻bug出现了想到看到日志输出,却无法看到时的尴尬呢...
现在有了这个工具WPLogOutputer ,这些烦恼就没有了,快来试试吧
使用简单,只需一两步就拥有,快来试试吧

##【能做什么】

  • 与Xcode的日志控制台同步输出
  • 打印的日志信息可保存到沙盒,不错过bug的追踪
  • 可将保存的日志文件分享,通过QQ或者别的工具进行在线的传输,共享给其他开发人员,直接在线预览日志的信息
  • 日志文件中记录着日志的打印时间,做到日志可控

###先来几个图

日志信息
image

演示图2
image

演示图3
image

演示图4
image

用法简介

###【使用CocoaPods】

pod 'WPLogOutputer'

###【或者手动导入】

  • 【直接下载源代码,将WPLogOutputer文件夹拽入项目中】

###【具体用法】

  1. 为了方便全局使用在PrefixHeader.pch导入主头文件:#import "WPLogOutputer.h"
  2. 习惯在项目中类似全局Macro.h文件中全局重写NSLog
    • a.只要在项目中调用NSLog(FORMAT, ...)即可在Xcode控制台和日志打印神器上同步输出
    • b.可以打印出我们想要的日志格式,方便找出日志打印所在的代码行
//#define kAppStore // 上架到appStore开关,打开就说明日志不会同步到WPLogOutputer
#ifndef  kAppStore
#define NSLog(FORMAT, ...) {NSString *log = [NSString stringWithFormat:FORMAT, ##__VA_ARGS__];fprintf(stderr,"\n%s %d -> %s\n", __FUNCTION__, __LINE__, [log UTF8String]);[WPLogOutputer printLog:[NSString stringWithFormat:@"%s<Line:%d>:%@", __FUNCTION__, __LINE__,[NSString stringWithFormat:@"%@",log]]];}
#else
#define NSLog(FORMAT, ...)  nil
#endif

3.在适当时候将日志打印工具显示出来,如在AppDelegate中开启日志打印控件

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // 开启打印
    [WPLogOutputer showLogOutputer];
    return YES;
}
  • 但通常是我们不需要日志打印神器,而是在某个时刻我们让它出现进行调试,再此笔者推荐以下做法
 // 推荐做法
 { 
 // 放在项目中的BaseViewController中
	UITapGestureRecognizer *singleFingerOne = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(fingerIncident:)];
 	singleFingerOne.numberOfTouchesRequired = 3;// 手指数
 	singleFingerOne.numberOfTapsRequired = 5;// 点击次数
 	[self.view addGestureRecognizer:singleFingerOne];
 }
 
 - (void)fingerIncident:(UITapGestureRecognizer *)ges {
 	[WPLogOutputer showLogOutputer];
 }

这样的话就可以通过三指点击屏幕5次即可调用日志打印神器

  • 当然你可以直接使用宏WPLog(FORMAT, ...)来直接将想要的打印内容输出到离线日志打印神器上

使用就是这样么轻松!

###具体用法参考Demo

期待

  • 第一次开源,多有不足,忘多多指教!
  • 如果在使用过程中遇到BUG,希望你能Issues我,谢谢

wplogoutputer's People

Contributors

anrikgwp avatar

Watchers

James Cloos avatar teng 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.