{"id":7852,"date":"2015-10-31T15:01:41","date_gmt":"2015-10-31T15:01:41","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2015\/10\/31\/cocoalumberjack-with-swift-calling-preprocessor-macros-open-source-projects-cocoalumberjack-cocoalumberjack\/"},"modified":"2015-10-31T15:01:41","modified_gmt":"2015-10-31T15:01:41","slug":"cocoalumberjack-with-swift-calling-preprocessor-macros-open-source-projects-cocoalumberjack-cocoalumberjack","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2015\/10\/31\/cocoalumberjack-with-swift-calling-preprocessor-macros-open-source-projects-cocoalumberjack-cocoalumberjack\/","title":{"rendered":"CocoaLumberjack with Swift &#8211; Calling preprocessor macros-open source projects CocoaLumberjack\/CocoaLumberjack"},"content":{"rendered":"<p>I started to build an IOS app with the new programming language Swift. I managed to use CocoaPods and was able to successfully create the DDTTYLogger with my CustomLoggerFormatter (Objective-C) in my AppDelegate.swift and append it to the loggers.<\/p>\n<pre><code>var customLoggerFormatter = CustomLoggerFormatter()\n\nvar consoleLogger: DDTTYLogger = DDTTYLogger.sharedInstance()\nconsoleLogger.setLogFormatter(customLoggerFormatter)\nDDLog.addLogger(consoleLogger)\n<\/code><\/pre>\n<p>But the problem is, that the CocoaLumberjack Library is using <em>preprocessor macros<\/em> for the logger methods like <code>DDLogVerbose(@\"..\")<\/code><\/p>\n<p>Which is defined in the DDLog.h:<\/p>\n<pre><code>#define DDLogVerbose(frmt, ...) LOG_OBJC_MAYBE(LOG_ASYNC_VERBOSE, LOG_LEVEL_DEF, LOG_FLAG_VERBOSE, 0, frmt, ##__VA_ARGS__)\n<\/code><\/pre>\n<p>Is there any workaround to make preprocessor defines work in Swift? Or did anyone try something similar with more success?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I started to build an IOS app with the new programming language Swift. I managed to use CocoaPods and was able to successfully create the DDTTYLogger with my CustomLoggerFormatter (Objective-C) in my AppDelegate.swift and append it to the loggers. var customLoggerFormatter = CustomLoggerFormatter() var consoleLogger: DDTTYLogger = DDTTYLogger.sharedInstance() consoleLogger.setLogFormatter(customLoggerFormatter) DDLog.addLogger(consoleLogger) But the problem is, that [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-7852","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7852","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=7852"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7852\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=7852"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=7852"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=7852"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}