fpillet/NSLogger

Print Function, line number in XCode Console.

isadon opened this issue · 2 comments

Is there a way to get NSLogger to log the line number and fuction number like XCGLogger does but in the Xcode Console. I can see the function information in the app but I also want to see it in the Xcode console.

@donileo You can modify the printout function in LoggerClient.m, specifically in this function https://github.com/fpillet/NSLogger/blob/master/Client/iOS/LoggerClient.m#L964

The idea is to extract these values from the binary log a few lines before this, then use them in the printout format. I didn't originally do it because it cluttered the display too much.

@donileo Another way to do this is to include the information in your Swift macros that perform logging. Just encapsulate the message to log that you get in another String like:

let file = #file
let line = #line
let message = "\(file):\(line) \(log)"