How do I get a formatted NSString from format and va_list?

后端 未结 1 915
北恋
北恋 2021-01-11 17:09

I\'m developing a static library that will be distributed to other developers, who may need debug statements. So I have several levels of logging.

In order to avoid

相关标签:
1条回答
  • 2021-01-11 17:41
    NSString *fullString = [[[NSString alloc] initWithFormat:format arguments:args] autorelease];
    

    There is a method for that ;)

    Although I suggest not to use functions, but some simple macro definitions:

    #define myLogLevel1(format, ...) myLog(1, format, __VA_ARGS__)
    #define myLogLevel2(format, ...) myLog(2, format, __VA_ARGS__)
    
    0 讨论(0)
提交回复
热议问题