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

@@ -228,7 +228,7 @@
};
}
} else {
NSLog(@"ERROR: Tried to register controller callbacks on NULL controller");
Log(LOG_W, @"Tried to register controller callbacks on NULL controller");
}
}
@@ -277,7 +277,7 @@
limeController.playerIndex = i;
[_controllers setObject:limeController forKey:[NSNumber numberWithInteger:controller.playerIndex]];
NSLog(@"Assigning controller index: %d", i);
Log(LOG_I, @"Assigning controller index: %d", i);
break;
}
}
@@ -291,7 +291,7 @@
_controllers = [[NSMutableDictionary alloc] init];
_controllerNumbers = 0;
NSLog(@"Number of controllers connected: %ld", (long)[[GCController controllers] count]);
Log(LOG_I, @"Number of controllers connected: %ld", (long)[[GCController controllers] count]);
for (GCController* controller in [GCController controllers]) {
[self assignController:controller];
[self registerControllerCallbacks:controller];
@@ -299,7 +299,7 @@
}
self.connectObserver = [[NSNotificationCenter defaultCenter] addObserverForName:GCControllerDidConnectNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note) {
NSLog(@"Controller connected!");
Log(LOG_I, @"Controller connected!");
GCController* controller = note.object;
[self assignController:controller];
@@ -311,13 +311,13 @@
[self updateAutoOnScreenControlMode];
}];
self.disconnectObserver = [[NSNotificationCenter defaultCenter] addObserverForName:GCControllerDidDisconnectNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note) {
NSLog(@"Controller disconnected!");
Log(LOG_I, @"Controller disconnected!");
GCController* controller = note.object;
[self unregisterControllerCallbacks:controller];
[_controllers removeObjectForKey:[NSNumber numberWithInteger:controller.playerIndex]];
_controllerNumbers &= ~(1 << controller.playerIndex);
NSLog(@"Unassigning controller index: %ld", (long)controller.playerIndex);
Log(LOG_I, @"Unassigning controller index: %ld", (long)controller.playerIndex);
// Re-evaluate the on-screen control mode
[self updateAutoOnScreenControlMode];

View File

@@ -205,7 +205,7 @@ static float L3_Y;
[self hideL3R3]; // Full controls don't need these they have the sticks
break;
default:
NSLog(@"Unknown on-screen controls level: %d", (int)_level);
Log(LOG_W, @"Unknown on-screen controls level: %d", (int)_level);
break;
}
}

View File

@@ -38,13 +38,13 @@
[controllerSupport initAutoOnScreenControlMode:onScreenControls];
}
else {
NSLog(@"Setting manual on-screen controls level: %d", (int)level);
Log(LOG_I, @"Setting manual on-screen controls level: %d", (int)level);
[onScreenControls setLevel:level];
}
}
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
NSLog(@"Touch down");
Log(LOG_D, @"Touch down");
if (![onScreenControls handleTouchDownEvent:touches]) {
UITouch *touch = [[event allTouches] anyObject];
touchLocation = [touch locationInView:self];
@@ -88,11 +88,11 @@
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
NSLog(@"Touch up");
Log(LOG_D, @"Touch up");
if (![onScreenControls handleTouchUpEvent:touches]) {
if (!touchMoved) {
if ([[event allTouches] count] == 2) {
NSLog(@"Sending right mouse button press");
Log(LOG_D, @"Sending right mouse button press");
LiSendMouseButtonEvent(BUTTON_ACTION_PRESS, BUTTON_RIGHT);
@@ -103,7 +103,7 @@
} else {
NSLog(@"Sending left mouse button press");
Log(LOG_D, @"Sending left mouse button press");
LiSendMouseButtonEvent(BUTTON_ACTION_PRESS, BUTTON_LEFT);