DSLogs
Description
DSLogs provides a very simple set of macros that wrap around NSLog().
When releasing apps to the App Store, it's usually good to disable NSLog(). These macros provide a simple way to manage this.
Usage
Code | Console Output |
---|---|
DLog(@"Message"); | FILE:LineNum Message |
WLog(@"Message"); | FILE:LineNum WARNING: Message |
ELog(@"Message"); | FILE:LineNum ERROR: Message |
When ENABLE_LOGS is not specified, DLog() resolves to a no-op.
Requirements
Installation
DSLogs is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "DSLogs"
To enable DLog(), you will need to add some compile-time settings. Go to your project build settings.
For Objective-C, under Custom Compiler Flags, add the following to Other C Flags: Debug: -DENABLE_LOGS=1 Release: -DENABLE_LOGS=0
For Swift, under Custom Flags, add the following to your Active Compilation Conditoins: Debug: ENABLE_LOGS
Note that for swift
For Objective-C, you should add the following to a common header file:
#import <DSLogs.h>
For Swift, you will need to add the following where you expect to use DSLogs:
import DSLogs
Author
Danny Sung, [email protected]
License
DSLogs is available under the MIT license. See the LICENSE file for more info.