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

  • 相关阅读:
    经典的标量子查询
    Perl 正则二
    v$sql和v$sqlarea
    Flex中TabNavigator隐藏和显示选项卡
    如何优化buffer_cache
    perl 限制用户操作
    perl 正则
    latch 为什么消耗CPU
    Oracle 写脏数据的不同场景
    block放入哪个hash bucket算法
  • 原文地址:https://www.cnblogs.com/iprogrammer/p/3248398.html
Copyright © 2020-2023  润新知