Latest 1.0.0
Homepage https://github.com/IvanChan/ICTraceLog
License MIT
Platforms ios 7.0, requires ARC
Authors

CI Status
Version
License
Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

ICTraceLog is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "ICTraceLog"

Usage

Setup you own log

#define MY_LOAD_IDENTIFIER @"Chocolate"

ICTraceLogManager *manager = [DEFAULT_TRACE_LOG_CENTER registerTraceIdentifier:MY_LOAD_IDENTIFIER];

// If need to save to disk
NSString *path = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/test.log"];
ICTraceLogIOWriterFile *fileWriter = [[ICTraceLogIOWriterFile alloc] initWithFilePath:path];
[manager addIOWriter:fileWriter];

Try to log something

    TLOG_DEBUG(MY_LOAD_IDENTIFIER, @"log enabled to disk: %@n", path);
    TLOG_INFO(MY_LOAD_IDENTIFIER, @"Just info");
    TLOG_WARN(MY_LOAD_IDENTIFIER, @"This is a warning");
    TLOG_ERROR(MY_LOAD_IDENTIFIER, @"Error will show selector & line number");
    TLOG_FATAL(MY_LOAD_IDENTIFIER, @"Fatal will do the same, And you won't see the next log");

    [manager resetLoggingLevelWithString:@"WARN|ERROR|FATAL"];

    TLOG_DEBUG(MY_LOAD_IDENTIFIER, @"You can't see me");
    TLOG_INFO(MY_LOAD_IDENTIFIER, @"and me");

Result will be

  [Chocolate]  2017-05-12 15:51:19, 2819  [DEBUG] log enabled to disk: /Users/_ivanc/Library/Developer/CoreSimulator/Devices/B97A9304-14FA-4556-8734-E344A8EC2A11/data/Containers/Data/Application/026688AC-9344-4EBE-B1ED-4BAD49298332/Documents/test.log

  [Chocolate]  2017-05-12 15:51:19, 2819  [INFO] Just info  
  [Chocolate]  2017-05-12 15:51:19, 2819  [ERROR] Error will show selector & line number 
 ****** -[ICViewController viewDidLoad] LINE:36 ****** 

  [Chocolate]  2017-05-12 15:51:19, 2819  [FATAL] Fatal will do the same, And you won't see the next log 
 ****** -[ICViewController viewDidLoad] LINE:37 ****** 

Author

_ivanC

License

ICTraceLog is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "ICTraceLog",
    "version": "1.0.0",
    "summary": "A simple log system with level control & output control",
    "description": "Simple log system with level control & output control, easy to use.",
    "homepage": "https://github.com/IvanChan/ICTraceLog",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "_ivanC": "_ivanC"
    },
    "source": {
        "git": "https://github.com/IvanChan/ICTraceLog.git",
        "tag": "1.0.0"
    },
    "platforms": {
        "ios": "7.0"
    },
    "source_files": "ICTraceLog/Classes/**/*",
    "requires_arc": true
}

Pin It on Pinterest

Share This