XcodeColors Is Dead :(

So it looks like Apple’s killed XcodeColors</a> in Xcode8 (as well as virtually every other plugin), breaking the ability to have coloured log messages in the console. This is a huge letdown as colors helped to differentiate between different log levels when using CocoaLumberjack!

Browing through an issue on Github gave me an idea to use emojis as a temporary solution:

_config.yml

_config.yml

Wasn’t a huge fan of the lack of colour variation but I think I’m happy with this set:

_config.yml

This is what my custom formatter looks like now:

- (NSString*)formatLogMessage:(DDLogMessage *)logMessage
{
    NSString *path = logMessage-&gt;_file;
    NSString *fileName = [path lastPathComponent];
    NSString *dateAndTime = [self stringFromDate:(logMessage-&gt;_timestamp)];
    
    NSString *logLevel;
    switch (logMessage-&gt;_flag) {
        case DDLogFlagError    : logLevel = @""&#x1f4d5;""; break;
        case DDLogFlagWarning  : logLevel = @""&#x1f4d2;""; break;
        case DDLogFlagInfo     : logLevel = @""&#x1f4d8;""; break;
        case DDLogFlagDebug    : logLevel = @""&#x1f4d7;""; break;
        default                : logLevel = @""&#x1f4d3;""; break;
    }
    
    return [NSString stringWithFormat:@""%@%@%@ %@:%lu %@"", logLevel, dateAndTime, logMessage-&gt;_function, fileName, (unsigned long)logMessage-&gt;_line, logMessage-&gt;_message];
}

While not nearly as good as what we had before there is one advantage: since emojis are being used it means that they’ll copy over when the text is copied.

Written on October 5, 2016