Skip to content

Commit 991e969

Browse files
committed
Bug fix for issue robbiehanson#223 - Logging is hardcoded to off, so enabling it requires forking the repo
1 parent 8feab23 commit 991e969

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

GCD/GCDAsyncSocket.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ extern NSString *const GCDAsyncSocketSSLDiffieHellmanParameters;
7777
#endif
7878
#endif
7979

80+
#define GCDAsyncSocketLoggingContext 65535
81+
82+
8083
enum GCDAsyncSocketError
8184
{
8285
GCDAsyncSocketNoError = 0, // Never used

GCD/GCDAsyncSocket.m

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@
3333
#endif
3434

3535

36-
#if 0
36+
#ifndef GCDAsyncSocketLoggingEnabled
37+
#define GCDAsyncSocketLoggingEnabled 0
38+
#endif
39+
40+
#if GCDAsyncSocketLoggingEnabled
3741

3842
// Logging Enabled - See log level below
3943

@@ -44,7 +48,7 @@
4448
#import "DDLog.h"
4549

4650
#define LogAsync YES
47-
#define LogContext 65535
51+
#define LogContext GCDAsyncSocketLoggingContext
4852

4953
#define LogObjc(flg, frmt, ...) LOG_OBJC_MAYBE(LogAsync, logLevel, flg, LogContext, frmt, ##__VA_ARGS__)
5054
#define LogC(flg, frmt, ...) LOG_C_MAYBE(LogAsync, logLevel, flg, LogContext, frmt, ##__VA_ARGS__)
@@ -62,8 +66,12 @@
6266
#define LogTrace() LogObjc(LOG_FLAG_VERBOSE, @"%@: %@", THIS_FILE, THIS_METHOD)
6367
#define LogCTrace() LogC(LOG_FLAG_VERBOSE, @"%@: %s", THIS_FILE, __FUNCTION__)
6468

69+
#ifndef GCDAsyncSocketLogLevel
70+
#define GCDAsyncSocketLogLevel LOG_LEVEL_VERBOSE
71+
#endif
72+
6573
// Log levels : off, error, warn, info, verbose
66-
static const int logLevel = LOG_LEVEL_VERBOSE;
74+
static const int logLevel = GCDAsyncSocketLogLevel;
6775

6876
#else
6977

0 commit comments

Comments
 (0)