What is the best way to include self
in each log message in CocoaLumberjack?
What I tried:
- Implementing the
DDLogFormatter
protocol - the caller of the log message is not available in theformatLogMessage:
method. #define
ing something like:#define LogInfo(frmt, ...) DDLogInfo(([NSString stringWithFormat:@"%@: %@", self, frmt]), ##__VA_ARGS__)
(note the extra()
around the[NSString ...]
- thanks hamstergenewhich will create a problem whenever I want to reference
self
weakly, e.g. callingLogInfo
inside a block - includingself
would potentially cause memory problems.
What am I missing? Any other better logging library?