From 06bdf251f0c99f1bcbebb27b792ad90cec62631e Mon Sep 17 00:00:00 2001 From: Benjamin Reis Date: Thu, 2 Feb 2017 16:31:06 +0100 Subject: [PATCH] Log not truncated in syslog --- Classes/Utils/Log.m | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Classes/Utils/Log.m b/Classes/Utils/Log.m index 18edc3041..f89f2d095 100644 --- a/Classes/Utils/Log.m +++ b/Classes/Utils/Log.m @@ -114,8 +114,20 @@ void linphone_iphone_log_handler(const char *domain, OrtpLogLevel lev, const cha case ORTP_LOGLEV_END: return; } - os_log_with_type(log, type, "%{public}s/%{public}s", domain, - [formatedString stringByReplacingOccurrencesOfString:@"\r\n" withString:@"\n"].UTF8String); + if ([formatedString containsString:@"\n"]) { + NSArray *myWords = [[formatedString stringByReplacingOccurrencesOfString:@"\r\n" withString:@"\n"] + componentsSeparatedByString:@"\n"]; + for (int i = 0; i < myWords.count; i++) { + NSString *tab = i > 0 ? @"\t" : @""; + if (((NSString *)myWords[i]).length > 0) { + os_log_with_type(log, type, "%{public}s%{public}s", tab.UTF8String, + ((NSString *)myWords[i]).UTF8String); + } + } + } else { + os_log_with_type(log, type, "%{public}s/%{public}s", domain, + [formatedString stringByReplacingOccurrencesOfString:@"\r\n" withString:@"\n"].UTF8String); + } } else { int lvl = ASL_LEVEL_NOTICE; switch (lev) {