From df68b90dbf43ffeb563fc5d6f1fa34bccdcdf8bb Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sun, 4 Nov 2018 15:39:50 +0100 Subject: Replace `NSLog`ged error messages with `teprintf` Use our own custom error formatter. I think `NSLog` messages get sent to syslog in a release build. This allows us to format the error messages the way we want and ensure they get printed to stderr. --- DomeKey/Mappings.h | 1 + DomeKey/Mappings.m | 3 +-- DomeKey/main.m | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/DomeKey/Mappings.h b/DomeKey/Mappings.h index acd3546..ba0930d 100644 --- a/DomeKey/Mappings.h +++ b/DomeKey/Mappings.h @@ -10,6 +10,7 @@ #include #import "dome_key_map.h" +#import "log.h" @interface Mappings : NSObject diff --git a/DomeKey/Mappings.m b/DomeKey/Mappings.m index 382dbba..072cd11 100644 --- a/DomeKey/Mappings.m +++ b/DomeKey/Mappings.m @@ -73,9 +73,8 @@ void reload_mappings( { uint32_t status = notify_post(NOTIFICATION_NAME_RELOAD); if (status != 0) { - // TODO: print to stderr // Notification failed - NSLog(@"Reload notification failed"); + teprintf("Reload notification failed"); } else { // Run `dome_key_state_load_map_group()` to print any error messages diff --git a/DomeKey/main.m b/DomeKey/main.m index 7c2f1c7..a64b3d5 100644 --- a/DomeKey/main.m +++ b/DomeKey/main.m @@ -14,6 +14,7 @@ #import "LicenseHandler.h" #import "Mappings.h" #import "dome_key_map.h" +#import "log.h" static const char *VERSION = "1.0"; @@ -21,7 +22,7 @@ int main(int argc, const char * argv[]) { Config *config = dome_key_config_get(); if (!config) { - NSLog(@"Unable to get config"); + teprintf("Unable to get config"); return EX_CONFIG; } -- cgit v1.2.3