Git Product home page Git Product logo

ictracelog's Introduction

ICTraceLog

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.

ictracelog's People

Contributors

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