Global log level for CocoaLumberjack

Marcos Crispino picture Marcos Crispino · Feb 25, 2011 · Viewed 16.8k times · Source

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 that bugs me: there doesn't seem to be an elegant way to define a log level for the whole app. To make it work I need to define a constant in every source file, like this:

static const int ddLogLevel = LOG_LEVEL_VERBOSE;

So, is there a way to define a global log level for the application?

I found this article on the subject, but I still need to add an #import in every file...

Answer

FreeAsInBeer picture FreeAsInBeer · Mar 1, 2011

You could use an #include statement in your *.pch file so that it's automatically included in all your project's files.