Global log level for CocoaLumberjack

后端 未结 12 970
[愿得一人]
[愿得一人] 2020-12-23 20:19

I\'m using CocoaLumberjack in an iPhone project, to log some information.

I\'ve followed the Getting started guide, and everything works fine, but there is one thing

12条回答
  •  自闭症患者
    2020-12-23 20:53

    There is a much easier way to solve this, you can set the log level at the Logger instantiation:

    #ifdef DEBUG
      [DDLog addLogger:[DDTTYLogger sharedInstance] withLevel:DDLogLevelDebug];
    #else
      [DDLog addLogger:[DDTTYLogger sharedInstance] withLevel:DDLogLevelError];
    #endif
    

    So there is no need for extra imports or .pch-file.

提交回复
热议问题