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 the CocoaLumberjack Library is using preprocessor macros for the logger methods like DDLogVerbose(@"..")
Which is defined in the DDLog.h:
#define DDLogVerbose(frmt, ...) LOG_OBJC_MAYBE(LOG_ASYNC_VERBOSE, LOG_LEVEL_DEF, LOG_FLAG_VERBOSE, 0, frmt, ##__VA_ARGS__)
Is there any workaround to make preprocessor defines work in Swift? Or did anyone try something similar with more success?
ProjectName-Bridging-Header.h
? I tried#import <DDLogWrapper.h>
and Xcode is complainingfile not found
error.DDLogWrapper.h
is in directoryProjectName/Application/DDLogWrapper.h
. I also triedApplication/DDLogWrapper.h
and that didn't work. MySWIFT_OBJC_BRIDGING_HEADER
field inBuild Settings
is blank but I have no problems bridging other modules. – Tangency