Skip to content

Commit

Permalink
Refactor DNS log message and log level.
Browse files Browse the repository at this point in the history
  • Loading branch information
rickyzhang82 committed Jul 20, 2016
1 parent b44b62b commit 06e35bb
Show file tree
Hide file tree
Showing 6 changed files with 121 additions and 85 deletions.
19 changes: 19 additions & 0 deletions NSLogger/LogLevel.h
@@ -0,0 +1,19 @@
//
// LogLevel.h
// SOCKS
//
// Created by Ricky Zhang on 7/20/16.
//
//

#ifndef LogLevel_h
#define LogLevel_h

//define NSLogger level
#define NSLOGGER_LEVEL_ERROR 0
#define NSLOGGER_LEVEL_WARNNING 1
#define NSLOGGER_LEVEL_INFO 2
#define NSLOGGER_LEVEL_DEBUG 3
#define NSLOGGER_LEVEL_TRACE 4

#endif /* LogLevel_h */
7 changes: 0 additions & 7 deletions NSLogger/LoggerClient.h
Expand Up @@ -44,13 +44,6 @@
#import <CoreServices/CoreServices.h>
#endif

//define NSLogger level
#define NSLOGGER_LEVEL_ERROR 0
#define NSLOGGER_LEVEL_WARNNING 1
#define NSLOGGER_LEVEL_INFO 2
#define NSLOGGER_LEVEL_DEBUG 3
#define NSLOGGER_LEVEL_TRACE 4

// This define is here so that user application can test whether NSLogger Client is
// being included in the project, and potentially configure their macros accordingly
#define NSLOGGER_WAS_HERE 1
Expand Down
2 changes: 2 additions & 0 deletions SOCKS.xcodeproj/project.pbxproj
Expand Up @@ -78,6 +78,7 @@
9C95E98318393629004559EB /* LoggerClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LoggerClient.h; path = NSLogger/LoggerClient.h; sourceTree = "<group>"; };
9C95E98418393629004559EB /* LoggerClient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = LoggerClient.m; path = NSLogger/LoggerClient.m; sourceTree = "<group>"; };
9C95E98518393629004559EB /* LoggerCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LoggerCommon.h; path = NSLogger/LoggerCommon.h; sourceTree = "<group>"; };
9CBABD221D3FEA9E00A8A382 /* LogLevel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = LogLevel.h; path = NSLogger/LogLevel.h; sourceTree = "<group>"; };
E40F65FF0FB1E38600D92710 /* SocksProxy.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SocksProxy.mm; sourceTree = "<group>"; };
E40F66000FB1E38600D92710 /* SocksProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SocksProxy.h; sourceTree = "<group>"; };
E40F66B90FB3029A00D92710 /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = System/Library/Frameworks/CFNetwork.framework; sourceTree = SDKROOT; };
Expand Down Expand Up @@ -252,6 +253,7 @@
9C95E98318393629004559EB /* LoggerClient.h */,
9C95E98418393629004559EB /* LoggerClient.m */,
9C95E98518393629004559EB /* LoggerCommon.h */,
9CBABD221D3FEA9E00A8A382 /* LogLevel.h */,
);
name = NSLogger;
sourceTree = "<group>";
Expand Down
2 changes: 2 additions & 0 deletions SocksProxy_Prefix.pch
Expand Up @@ -11,6 +11,8 @@
#import "UIDevice_Extended.h"
#endif

#include "LogLevel.h"

#define USE_NSLOGGER_LIB 1


Expand Down
8 changes: 6 additions & 2 deletions ttdnsd/ttdnsd.h
Expand Up @@ -30,6 +30,11 @@
#include <pthread.h>
#include "ttdnsd_platform.h"

#ifdef NOT_HAVE_COCOA_FRAMEWORK
#include <stdarg.h>
#include "../NSLogger/LogLevel.h"
#endif


const char TTDNSD_VERSION[]= "v1.0";

Expand Down Expand Up @@ -186,8 +191,7 @@ class DNSServer{
struct in_addr socks5_proxy_select(void);

#ifndef NOT_HAVE_COCOA_FRAMEWORK
int printf(const char * __restrict format, ...);
void perror(const char *__s);
int print_level(int level, const char * __restrict format, ...);
#endif

static void * _dns_srv_thread_wrapper(void*){
Expand Down

0 comments on commit 06e35bb

Please sign in to comment.