zoukankan      html  css  js  c++  java
  • Objective C 总结(十五):Logging

    NSMutableArray *someObject = [NSMutableArray array];
    NSLog(@"%s:%d someObject=%@", __func__, __LINE__, someObject);
    [someObject addObject:@"foo"];
    NSLog(@"%s:%d someObject=%@", __func__, __LINE__, someObject);


    Table 1  Preprocessor macros and for logging in C/C++/Objective-C.

    Macro

    Format Specifier

    Description

    __func__

    %s

    Current function signature.

    __LINE__

    %d

    Current line number in the source code file.

    __FILE__

    %s

    Full path to the source code file.

    __PRETTY_FUNCTION__

    %s

    Like __func__, but includes verbose type information in C++ code.

    Table 2  Expressions for logging in Objective-C.

    Expression

    Format Specifier

    Description

    NSStringFromSelector(_cmd)

    %@

    Name of the current selector.

    NSStringFromClass([self class])

    %@

    Name of the current object's class.

    [[NSString stringWithUTF8String:__FILE__] lastPathComponent]

    %@

    Name of the source code file.

    [NSThread callStackSymbols]

    %@

    NSArray of the current stack trace as programmer-readable strings. For debugging only, do not present it to end users or use to do any logic in your program.

  • 相关阅读:
    输入分隔符
    GO
    match|align|identify|cover_rate
    KEGG
    InterProScan
    Functional annotation
    GeneWise
    get middle lines
    goland debug web app with urfave cli
    go mod proxy
  • 原文地址:https://www.cnblogs.com/iprogrammer/p/3248398.html
Copyright © 2011-2022 走看看