Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Global log level for CocoaLumberjack

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...

like image 467
Marcos Crispino Avatar asked Feb 25 '11 13:02

Marcos Crispino


People also ask

How do I use CocoaLumberjack in Swift?

There is a file called `CocoaLumberjack. swift`, drag that file into the `Pods` project, I suggest into the `Pods/CocoaLumberjack/Default` group. When XCode gives you options for adding the files make sure to leave `Copy items if needed` unchecked.

What is Cocoa Lumberjack?

CocoaLumberjack is one of the most popular logging frameworks available for iOS development and testing. It is specifically designed for advanced development practices and that's why it is not the easiest option for first timers.


1 Answers

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

like image 171
FreeAsInBeer Avatar answered Oct 14 '22 15:10

FreeAsInBeer