Avoid using NSLog() where we can

pull/69/merge
Ludovic Marcotte 2015-01-22 13:31:31 -05:00
parent d98ff69fbe
commit d907d5d268
5 changed files with 19 additions and 17 deletions

View File

@ -33,6 +33,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#import <Foundation/NSString.h> #import <Foundation/NSString.h>
#import <NGExtensions/NGBase64Coding.h> #import <NGExtensions/NGBase64Coding.h>
#import <NGExtensions/NSObject+Logs.h>
#include <wbxml/wbxml.h> #include <wbxml/wbxml.h>
#include <wbxml/wbxml_conv.h> #include <wbxml/wbxml_conv.h>
@ -48,7 +49,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
path = [NSString stringWithFormat: @"/tmp/%@.data", [[NSProcessInfo processInfo] globallyUniqueString]]; path = [NSString stringWithFormat: @"/tmp/%@.data", [[NSProcessInfo processInfo] globallyUniqueString]];
[self writeToFile: path atomically: YES]; [self writeToFile: path atomically: YES];
NSLog(@"Original data written to: %@", path); [self errorWithFormat: @"Original data written to: %@", path];
} }
// //
@ -81,7 +82,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
if (ret != WBXML_OK) if (ret != WBXML_OK)
{ {
NSLog(@"wbxml2xmlFromContent: failed: %s\n", wbxml_errors_string(ret)); [self errorWithFormat: @"wbxml2xmlFromContent: failed: %s\n", wbxml_errors_string(ret)];
[self _dumpToFile]; [self _dumpToFile];
return nil; return nil;
} }
@ -114,7 +115,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
if (ret != WBXML_OK) if (ret != WBXML_OK)
{ {
NSLog(@"xml2wbxmlFromContent: failed: %s\n", wbxml_errors_string(ret)); [self logWithFormat: @"xml2wbxmlFromContent: failed: %s\n", wbxml_errors_string(ret)];
[self _dumpToFile]; [self _dumpToFile];
return nil; return nil;
} }
@ -129,7 +130,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
if (ret != WBXML_OK) if (ret != WBXML_OK)
{ {
NSLog(@"xml2wbxmlFromContent: failed: %s\n", wbxml_errors_string(ret)); [self errorWithFormat: @"xml2wbxmlFromContent: failed: %s\n", wbxml_errors_string(ret)];
[self _dumpToFile]; [self _dumpToFile];
free(wbxml); free(wbxml);
wbxml_conv_xml2wbxml_destroy(conv); wbxml_conv_xml2wbxml_destroy(conv);

View File

@ -57,6 +57,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#import <NGCards/NGVCard.h> #import <NGCards/NGVCard.h>
#import <NGExtensions/NSCalendarDate+misc.h> #import <NGExtensions/NSCalendarDate+misc.h>
#import <NGExtensions/NSObject+Logs.h>
#import <NGExtensions/NSString+misc.h> #import <NGExtensions/NSString+misc.h>
#import <NGImap4/NSString+Imap4.h> #import <NGImap4/NSString+Imap4.h>
@ -287,9 +288,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
case ActiveSyncMailFolder: case ActiveSyncMailFolder:
default: default:
{ {
// FIXME // FIXME - what to do?
//continue; [self errorWithFormat: @"Fatal error occured - tried to call -processSyncAddCommand: ... on a mail folder. We abort."];
NSLog(@"BLARG!");
abort(); abort();
} }
} }
@ -1405,12 +1405,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
if (changeDetected) if (changeDetected)
{ {
NSLog(@"Change detected, we push the content."); [self logWithFormat: @"Change detected, we push the content."];
break; break;
} }
else else
{ {
NSLog(@"Sleeping %d seconds while detecting changes...", internalInterval); [self logWithFormat: @"Sleeping %d seconds while detecting changes...", internalInterval];
sleep(internalInterval); sleep(internalInterval);
} }
} }

View File

@ -59,6 +59,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#import <NGExtensions/NSCalendarDate+misc.h> #import <NGExtensions/NSCalendarDate+misc.h>
#import <NGExtensions/NGCalendarDateRange.h> #import <NGExtensions/NGCalendarDateRange.h>
#import <NGExtensions/NGHashMap.h> #import <NGExtensions/NGHashMap.h>
#import <NGExtensions/NSObject+Logs.h>
#import <NGExtensions/NSString+misc.h> #import <NGExtensions/NSString+misc.h>
#import <NGImap4/NGImap4Client.h> #import <NGImap4/NGImap4Client.h>
@ -1872,13 +1873,13 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
if ([foldersWithChanges count]) if ([foldersWithChanges count])
{ {
NSLog(@"Change detected, we push the content."); [self logWithFormat: @"Change detected, we push the content."];
status = 2; status = 2;
break; break;
} }
else else
{ {
NSLog(@"Sleeping %d seconds while detecting changes...", internalInterval); [self logWithFormat: @"Sleeping %d seconds while detecting changes...", internalInterval];
sleep(internalInterval); sleep(internalInterval);
} }
} }

View File

@ -245,7 +245,7 @@ static BOOL debugLeaks;
} }
else else
{ {
NSLog (@"No value specified for '%@'", *urlString); [self errorWithFormat: @"No value specified for '%@'", *urlString];
ok = NO; ok = NO;
} }
} }
@ -441,7 +441,7 @@ static BOOL debugLeaks;
if (debugLeaks) if (debugLeaks)
{ {
if (debugOn) if (debugOn)
NSLog (@"allocated classes:\n%s", GSDebugAllocationList (YES)); [self logWithFormat: @"allocated classes:\n%s", GSDebugAllocationList (YES)];
else else
{ {
debugOn = YES; debugOn = YES;

View File

@ -1,15 +1,15 @@
/* /*
Copyright (C) 2004-2005 SKYRIX Software AG Copyright (C) 2004-2005 SKYRIX Software AG
Copyright (C) 2006-2009 Inverse inc. Copyright (C) 2006-2015 Inverse inc.
This file is part of OpenGroupware.org. This file is part of SOGo.
OGo is free software; you can redistribute it and/or modify it under SOGo is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the the terms of the GNU Lesser General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any Free Software Foundation; either version 2, or (at your option) any
later version. later version.
OGo is distributed in the hope that it will be useful, but WITHOUT ANY SOGo is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details. License for more details.