3

I want to be able to open debug logging level for a specific file in my iOS application. We are using CocoaLumberJack in Swift as the logging framework. According to the documentation, this is possible in Objective C, but I could not find any documentation regarding Swift. Is it possible to do that? If so, how?

Thanks, Omer

oguz ismail
  • 1
  • 16
  • 47
  • 69
Omer Levi Hevroni
  • 1,935
  • 1
  • 15
  • 33

1 Answers1

0

Finally found out how to do that. I did that by creating another enum:

public enum CustomLogFlags : UInt{
    case test = 0b0100000
}

And then set the log level:

DDLog.logLevel = DDLogLevel(rawValue: DDLogLevel.error.rawValue | CustomLogFlags.test.rawValue) ?? DDLogLevel.error

Now you can log messages using the new log level:

let logLevel = DDLogFlag(rawValue: CustomLogFlags.test.rawValue)
let logMsg = DDLogMessage(message: message(), level: logLevel, flag: flag, context: 0,
                    file: file, function: function, line: line,
                    tag: tag, options: DDLogMessageOptions(rawValue: 0), timestamp: nil)
DDLog.log(logAsync, message: logMsg)
Omer Levi Hevroni
  • 1,935
  • 1
  • 15
  • 33