Skip to content

Commit

Permalink
Use hexadecimal for error code logging.
Browse files Browse the repository at this point in the history
  • Loading branch information
niw committed Jul 27, 2018
1 parent 4e5e952 commit 6f96a27
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions HapticKey/Classes/HTKLoginItem.m
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,12 @@ - (void)_htk_main_update
NSError *error;
NSArray * const snapshot = CaptureFileListSnapshot(self.fileList, &seed, &error);
if (error) {
os_log_error(OS_LOG_DEFAULT, "Fail to capture login items snapshot code: %ld", (long)error.code);
os_log_error(OS_LOG_DEFAULT, "Fail to capture login items snapshot code: 0x%lx", (long)error.code);
return;
}
id const fileListItem = FindFileListItemAtPathInFileListSnapshot(self.path, snapshot, &error);
if (error) {
os_log_error(OS_LOG_DEFAULT, "Fail to find login item at path: %{public}@ code: %ld", self.path, (long)error.code);
os_log_error(OS_LOG_DEFAULT, "Fail to find login item at path: %{public}@ code: 0x%lx", self.path, (long)error.code);
return;
}
[self _htk_main_setFileListItem:fileListItem seed:seed];
Expand Down Expand Up @@ -245,14 +245,14 @@ - (void)setEnabled:(BOOL)enabled
if (enabled) {
AddFileListItemAtPathToLoginItemsFileList(self.path, self.fileList, &error);
if (error) {
os_log_error(OS_LOG_DEFAULT, "Fail to add login item at path: %{public}@ code: %ld", self.path, (long)error.code);
os_log_error(OS_LOG_DEFAULT, "Fail to add login item at path: %{public}@ code: 0x%lx", self.path, (long)error.code);
return;
}
os_log_info(OS_LOG_DEFAULT, "Add login item at path: %{public}@", self.path);
} else {
RemoveFileListItemFromLoginItems(self.fileListItem, self.fileList, &error);
if (error) {
os_log_error(OS_LOG_DEFAULT, "Fail to remove login item at path: %{public}@ code: %ld", self.path, (long)error.code);
os_log_error(OS_LOG_DEFAULT, "Fail to remove login item at path: %{public}@ code: 0x%lx", self.path, (long)error.code);
return;
}
os_log_info(OS_LOG_DEFAULT, "Remove login item at path: %{public}@", self.path);
Expand Down
6 changes: 3 additions & 3 deletions HapticKey/Classes/HTKMultitouchActuator.m
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ - (void)_htk_main_openActuator

const IOReturn error = MTActuatorOpen(actuatorRef);
if (error != kIOReturnSuccess) {
os_log_error(OS_LOG_DEFAULT, "Fail to MTActuatorOpen: %p error: %d", _actuatorRef, error);
os_log_error(OS_LOG_DEFAULT, "Fail to MTActuatorOpen: %p error: 0x%x", _actuatorRef, error);
CFRelease(_actuatorRef);
_actuatorRef = NULL;
return;
Expand All @@ -97,7 +97,7 @@ - (void)_htk_main_closeActuator

const IOReturn error = MTActuatorClose(_actuatorRef);
if (error != kIOReturnSuccess) {
os_log_error(OS_LOG_DEFAULT, "Fail to MTActuatorClose: %p error: %d", _actuatorRef, error);
os_log_error(OS_LOG_DEFAULT, "Fail to MTActuatorClose: %p error: 0x%x", _actuatorRef, error);
}
CFRelease(_actuatorRef);
_actuatorRef = NULL;
Expand All @@ -112,7 +112,7 @@ - (BOOL)_htk_main_actuateActuationID:(SInt32)actuationID unknown1:(UInt32)unknow

const IOReturn error = MTActuatorActuate(_actuatorRef, actuationID, unknown1, unknown2, unknown3);
if (error != kIOReturnSuccess) {
os_log_error(OS_LOG_DEFAULT, "Fail to MTActuatorActuate: %p, %d, %d, %f, %f error: %d", _actuatorRef, actuationID, unknown1, unknown2, unknown3, error);
os_log_error(OS_LOG_DEFAULT, "Fail to MTActuatorActuate: %p, %d, %d, %f, %f error: 0x%x", _actuatorRef, actuationID, unknown1, unknown2, unknown3, error);
return NO;
} else {
return YES;
Expand Down
6 changes: 3 additions & 3 deletions HapticKey/Classes/HTKSystemSound.m
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ - (instancetype)initWithPath:(NSString *)path
NSURL *url = [[NSURL alloc] initFileURLWithPath:path];
OSStatus error = AudioServicesCreateSystemSoundID((__bridge CFURLRef)url, &systemSoundID);
if (error != noErr) {
os_log_error(OS_LOG_DEFAULT, "Fail to create system sound at path: %{public}@ code: %lu", path, (long)error);
os_log_error(OS_LOG_DEFAULT, "Fail to create system sound at path: %{public}@ code: 0x%lx", path, (long)error);
return nil;
} else {
os_log_info(OS_LOG_DEFAULT, "Create system sound at path: %{public}@ id: %lu", path, (long)systemSoundID);
os_log_info(OS_LOG_DEFAULT, "Create system sound at path: %{public}@ id: 0x%lx", path, (long)systemSoundID);
}
_systemSoundID = systemSoundID;
}
Expand All @@ -58,7 +58,7 @@ - (void)dealloc
{
OSStatus error = AudioServicesDisposeSystemSoundID(self.systemSoundID);
if (error != noErr) {
os_log_error(OS_LOG_DEFAULT, "Fail to dispose system sound id: %lu code: %lu", (long)self.systemSoundID, (long)error);
os_log_error(OS_LOG_DEFAULT, "Fail to dispose system sound id: %lu code: 0x%lx", (long)self.systemSoundID, (long)error);
}
}

Expand Down

0 comments on commit 6f96a27

Please sign in to comment.