Permalink
Browse files

Replaced all NSLog() instances with DLog();

do not #define DLog if user has already defined one;
  • Loading branch information...
1 parent eba7e8e commit 002b4c126f7c93cbad51dc1eb4093efea20bbc69 @stannedelchev stannedelchev committed Feb 2, 2014
Showing with 12 additions and 3 deletions.
  1. +12 −3 Lockbox.m
View
@@ -8,6 +8,15 @@
#import "Lockbox.h"
#import <Security/Security.h>
+// Define DLog if user hasn't already defined his own implementation
+#ifndef DLog
+#ifdef DEBUG
+#define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
+#else
+#define DLog(...)
+#endif
+#endif
+
#define kDelimiter @"-|-"
#define DEFAULT_ACCESSIBILITY kSecAttrAccessibleWhenUnlocked
@@ -82,7 +91,7 @@ +(BOOL)setObject:(NSString *)obj forKey:(NSString *)key accessibility:(CFTypeRef
status = SecItemAdd((LOCKBOX_DICTREF) dict, NULL);
}
if (status != errSecSuccess)
- NSLog(@"SecItemAdd failed for key %@: %d", hierKey, (int)status);
+ DLog(@"SecItemAdd failed for key %@: %d", hierKey, (int)status);
return (status == errSecSuccess);
}
@@ -98,7 +107,7 @@ +(NSString *)objectForKey:(NSString *)key
OSStatus status =
SecItemCopyMatching ( (LOCKBOX_DICTREF) query, (CFTypeRef *) &data );
if (status != errSecSuccess && status != errSecItemNotFound)
- NSLog(@"SecItemCopyMatching failed for key %@: %d", hierKey, (int)status);
+ DLog(@"SecItemCopyMatching failed for key %@: %d", hierKey, (int)status);
if (!data)
return nil;
@@ -201,7 +210,7 @@ + (NSDictionary *)dictionaryForKey:(NSString *)key
if ((keysAndValues.count % 2) != 0)
{
- NSLog(@"Dictionary for %@ was not saved properly to keychain", key);
+ DLog(@"Dictionary for %@ was not saved properly to keychain", key);
return nil;
}

0 comments on commit 002b4c1

Please sign in to comment.