-
Notifications
You must be signed in to change notification settings - Fork 268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Swift: Testing to see if XcodeColors is installed and enabled #40
Comments
I would have expected this to work:
It reports nil although the plugin is working |
try this |
I'm not getting clear behavior on this either. In Swift, I would expect the code to check whether XcodeColors was installed to be something like this: let canColor = NSProcessInfo().environment["XcodeColors"] == "YES" But, that environment variable is always nil. However, if I go set it manually, it can read it fine. setenv("XcodeColors", "YES", 0)
let canColor = NSProcessInfo().environment["XcodeColors"] == "YES" The colors DO work, I'm just not able to see if the plugin is installed. Any tips? |
Nevermind, I understand now. I'm working on an iOS app. The environment variables won't work in iOS because those environment variables are defined on my Mac, not on my iDevice or my simulator. That's a bit of a bummer - I want a way for this to "just work" for the developers that have XcodeColors installed, and gracefully fall back to normal logging for developers that don't. Is there any way to have user-specific environment variables defined for the simulator? |
Combined with cocoalumberjack, old C style \o/ DDLog.addLogger(DDTTYLogger.sharedInstance()) // TTY = Xcode console
let xcode_colors = getenv("XcodeColors");
if xcode_colors != nil && strcmp(xcode_colors, "YES") == 0 {
DDTTYLogger.sharedInstance().colorsEnabled = true;
} |
Using this with Alcatraz getenv("XcodeColors") never works. I've implemented the check both with Swift and with Objective C— it is never enabled. Tips? |
In the README, you provided a code snippet in C for testing, if XcodeColors is installed and enabled. How would that code look like in Swift?
The text was updated successfully, but these errors were encountered: