0

I am producing an iOS framework and currently have Debug and Release versions; the only way they differ is that the Debug version produces console logging (I use DLog for logging in my framework).

I don't think it's worthwhile shipping two versions of my framework just for that reason.

Is there an easy way to enable or disable logging at runtime within a consuming app?

Community
  • 1
  • 1
funkybro
  • 8,432
  • 6
  • 39
  • 52

2 Answers2

0

You will need to control logging via a variable, not a pre-processor constant. Then provide an API method to change this variable so the app can turn logging on/off.

Droppy
  • 9,691
  • 1
  • 20
  • 27
  • I was wondering more if there was an established pattern for achieving this within an iOS framework. – funkybro Dec 18 '14 at 13:08
  • No, not really. If you want to control the behaviour of a framework then that framework needs to expose functions/methods to control it. – Droppy Dec 18 '14 at 13:13
0

Here DLog is custom log class. In this class we can set NSLog() printable. In that application launch have to init this class with condition check for debug and release build.