I am trying to find a way for Cocoa Lumberjack to show me file and line number.
After looking through the docs and some Googling, I found no easy way to do this.
Well, like I said, there is no built-in way. So, I've implemented custom formatter:
@interface LineNumberLogFormatter : NSObject
- (NSString *)formatLogMessage:(DDLogMessage *)logMessage;
@end
@implementation LineNumberLogFormatter
- (NSString *)formatLogMessage:(DDLogMessage *)logMessage
{
NSString *path = [NSString stringWithCString:logMessage->file encoding:NSASCIIStringEncoding];
NSString *fileName = [path lastPathComponent];
return [NSString stringWithFormat:@"%@:%d %@", fileName, logMessage->lineNumber, logMessage->logMsg];
}
@end