KISS πŸ‡ΊπŸ‡¦

Stop the war!

Stop the war in Ukraine! Fuck putin!

More information is at: https://war.ukraine.ua/.

There is a fund to support the Ukrainian Army: https://savelife.in.ua/en/donate/, and there is a special bank account that accepts funds in multiple currencies: https://bank.gov.ua/en/about/support-the-armed-forces. I donated to them. Please donate if you can!

Killer putin

Killer putin. Source: politico.eu.

Arrested putin

"It hasn't happened yet, but it will happen sooner or later. Beautiful photo, isn't it?" Source: twitter.

Global dynamic log level in CocoaLumberjack

| comments

I use CocoaLumberjack for logging in one of the projects. Now the client wants the ability to change the log level at runtime in Settings. The official article (https://github.com/robbiehanson/CocoaLumberjack/wiki/DynamicLogLevels) suggests a simple solution: remove the const modifier from the definition of ddLogLevel, so you change it in runtime. However, if this var is defined in the shared precompiled header (project.pch file), every source code file gets its own copy.

To make it global, here’s my workaround: create a pair of files: AppLogging.h and AppLogging.m. Instead of declaring the ddLogLevel variable in the .pch file, #include the AppLogging.h file, where you move it to:

AppLogging.h
1
extern int ddLogLevel;
AppLogging.m
1
int ddLogLevel = LOG_LEVEL_ERROR;

Now, the whole program has access to this variable, being able to change the log level globally.

iOS

Note: The comments in the blog are provided by disqus.com; if you don't see the comment form under the post, probably your browser or its extension (such as uBlock Origin or NoScript) blocks their scripts.

« Yes. It runs with NetWare Jigsaw puzzle animation »

Comments