Configure some problem records for Cocoalumberjack

Source: Internet
Author: User

Want to complete a color log in Xcode, follow the steps in the GETTINGSTARTED.MD article to integrate Cocoalumberjack 2.x into my project, encountered some problems, of course, there are some pits, make a record.


Integration steps:

    • Drag into CocoaLumberjack/Framework/{Desktop/Mobile}/Lumberjack.xcodeproj your project

    • In your App target Build Settings

      • Add to ' User Header Search Paths '$(BUILD_ROOT)/../IntermediateBuildFilesPath/UninstalledProducts/include

      • Set ' always Search User Paths ' to YES

    • In your App target Build phases

      • ADD cocoalumberjack Static library target to ' target Dependencies '

      • Add to libCocoaLumberjack.a ' Link Binary with Libraries '

    • Include the framework in your source files with

#import <CocoaLumberjack/CocoaLumberjack.h>


1. The first is to compile the hint use of undeclared identifier ' log_level_verbose ' problem

This is what I did. The following code is added to the PCH file according to document XCODETRICKS.MD:

#ifdef DEBUG static const int ddloglevel = log_level_verbose; #else static const int ddloglevel = Log_level_warn; #endif

Step on the Pit 1, the log_level_verbose and Log_level_warn replaced with Ddloglevelverbose and Ddloglevelerror just fine.

The modified code should be:

#ifdef debugstatic const int ddloglevel = ddloglevelverbose; #elsestatic const int ddloglevel = Ddloglevelerror; #endif

Then add the following code in method Application:didfinishlaunchingwithoptions: To set the color display:

[Ddlog Addlogger:[ddasllogger sharedinstance]; [Ddlog Addlogger:[ddttylogger sharedinstance]; [[Ddttylogger sharedinstance] setcolorsenabled:yes];

To test the color display code:

Ddlogerror (@ "Paper jam");DD Logwarn (@ "Toner is low");DD Loginfo (@ "Warming up Printer (pre-customization)");D Dlogverbose (@ "intializing protcol x26 (pre-customization)");


2, color log display needs plug-in Xcodecolors plug-in support, this plugin i download is https://github.com/rvi/XcodeColors inside, because it supports the Xcode6.3.


3, with Cocoalumberjack demo textxcodecolors Engineering test, pod install after open textxcodecolors.xcodeproj, compile prompt ld:library not found for -lpods-txc_ios-cocoalumberjack

Again a pit. In general, you should generate a Xcworkspace file after the pod install, but without generating the Textxcodecolors.xcworkspace file, I'm surprised. Later found that should be open demos.xcworkspace, and then choose Textxcodecolors This target, of course, the premise is to go into the Textxcodecolors folder to perform pod install. Use "Pod install--verbose--no-repo-update" as much as possible


4, the demo test log color is normal, in their own projects will not show the color

Pit 3. The secret is to make the following adjustments to project's scheme:

In Xcode bring up the scheme Editor (Product---Edit scheme ...)
Select "Run", and then the "Arguments" tab
ADD a new environment Variable named "Xcodecolors" with a value of "YES"


Reference:
iOS Open source project log Framework Cocoalumberjack
Use Cocoalumberjack to build your own Log system

Colorful XCode Console





Configure some problem records for Cocoalumberjack

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.