Closed taher-mosbah closed 8 years ago
well you can't mix C strings with NSString *, they are completely different beasts, and you do that for sure given that you use %s while using @"", check your types and match it with formatting expressions and it should be ok
Hello, I'm trying to setup KZLinkedConsole with CocoaLumberjack 2.2 using your formatter at KZBootstrap/Logging in an Obj-c project.
Here is my code :
[DDLog addLogger:[DDTTYLogger sharedInstance] withLevel:globalLogLevel]; [DDLog addLogger:[DDASLLogger sharedInstance] withLevel:globalLogLevel]; [DDTTYLogger sharedInstance].logFormatter = [[KZBootstrapLogFormatter alloc] init]; [[DDTTYLogger sharedInstance] setColorsEnabled:YES];
I had some compilation errors in KZBootstrapLogFormatter.h L87 formatLogMessage:
So I changed
NSString *formattedMsg = [NSString stringWithFormat:@"%04ld-%02ld-%02ld %02ld:%02ld:%02ld:%03d [%s] %s:%d (%s): %@", (long)components.year, (long)components.month, (long)components.day, (long)components.hour, (long)components.minute, (long)components.second, milliseconds, CRLLogFlagToCString(logMessage->logFlag), CRLPointerToLastPathComponent(logMessage->file), logMessage->lineNumber, logMessage->function ?: "", logMessage->logMsg];
to
NSString *formattedMsg = [NSString stringWithFormat:@"%04ld-%02ld-%02ld %02ld:%02ld:%02ld:%03d [%s] %s:%d (%s): %@", (long)components.year, (long)components.month, (long)components.day, (long)components.hour, (long)components.minute, (long)components.second, milliseconds, CRLLogFlagToCString(logMessage->_file), logMessage->_file, logMessage->_line, logMessage->_function ?: @"", logMessage->_message];
but all what I get in console is :
2016-04-13 10:48:48:359 [DBG] »B:376 (»B): my_log_message
any suggestions ?
Thank you !