Created logger with log levels

This commit is contained in:
Diego Waxemberg
2015-02-10 21:26:55 -05:00
parent 0c36754ebe
commit e3dd4e7238
26 changed files with 182 additions and 113 deletions

View File

@@ -56,18 +56,18 @@ NSString *const deviceName = @"roth";
if (inet_addr([host UTF8String]) != INADDR_NONE) {
// Already an IP address
int addr = inet_addr([host UTF8String]);
NSLog(@"host address: %d", addr);
Log(LOG_I, @"host address: %d", addr);
return addr;
} else {
hostent = gethostbyname([host UTF8String]);
if (hostent != NULL) {
char* ipstr = inet_ntoa(*(struct in_addr*)hostent->h_addr_list[0]);
NSLog(@"Resolved %@ -> %s", host, ipstr);
Log(LOG_I, @"Resolved %@ -> %s", host, ipstr);
int addr = inet_addr(ipstr);
NSLog(@"host address: %d", addr);
Log(LOG_I, @"host address: %d", addr);
return addr;
} else {
NSLog(@"Failed to resolve host: %d", h_errno);
Log(LOG_W, @"Failed to resolve host: %d", h_errno);
return 0;
}
}