DEBUG

作者: 白色天空729 | 来源:发表于2019-01-27 11:07 被阅读1次
    //打印
    #if DEBUG
    #define DEBUGLOG(format, ...) do {\
    fprintf(stderr, "-----------------------------------------\n");             \
    fprintf(stderr, "File: %s\nFunc: %s\nLine: %d / Time: [%s]\n",         \
    [[[NSString stringWithUTF8String:__FILE__] lastPathComponent] UTF8String],  \
    __func__, __LINE__, __TIME__);                                              \
    fprintf(stderr, "Format:\n %s \n",                                          \
    [[NSString stringWithFormat:format, ##__VA_ARGS__] UTF8String]);            \
    fprintf(stderr, "-----------------------------------------\n\n");           \
    } while (0)
    
    #define _po(o) DEBUGLOG(@"%@", (o))
    #define _pn(o) DEBUGLOG(@"%d", (o))
    #define _pf(o) DEBUGLOG(@"%f", (o))
    #define _ps(o) DEBUGLOG(@"CGSize: {%.0f, %.0f}", (o).width, (o).height)
    #define _pr(o) DEBUGLOG(@"CGRect: {{%.0f, %.0f}, {%.0f, %.0f}}", (o).origin.x, (o).origin.y, (o).size.width, (o).size.height)
    
    #define OBJ(obj)  DEBUGLOG(@"%s: %@", #obj, [(obj) description])
    
    #define MARK    DEBUGLOG(@"\nMARK: %s, %d", __PRETTY_FUNCTION__, __LINE__)
    #else
    #define DEBUGLOG(format, ...) nil
    #endif
    
    

    相关文章

      网友评论

          本文标题:DEBUG

          本文链接:https://www.haomeiwen.com/subject/gyegjqtx.html