In Xcode, is there a way to disable the timestamps that appear in the debugger console when calling NSLog?

前端 未结 8 2309
别跟我提以往
别跟我提以往 2020-12-02 14:30

Xcode\'s debugger console makes it easy to see any debugging messages my app sends out using NSLog(), but it always sticks a timestamp prefix on them:



        
8条回答
  •  清歌不尽
    2020-12-02 15:05

    Clean Log Macro

    Here is a macro I've made for this purpose. It works exactly like NSLog but with just your text, no extra info


    Macro (paste to your .h)

    #define CLog(__string, ...) fprintf(stderr, "\n%s", [([NSString stringWithFormat:__string, ##__VA_ARGS__]) UTF8String])
    

    Example use:

    CLog(@"I am %i days and %i years old", 3, 7);
    

    Logs:

    I am 3 days and 7 years old

提交回复
热议问题