Giter Site home page Giter Site logo

Comments (6)

 avatar commented on August 23, 2024

I would have expected this to work:

let str = String.fromCString(getenv("XcodeColors")) // String?

It reports nil although the plugin is working
doing setenv("XcodeColors", "NO", 0) does not disable it.

from xcodecolors.

silan-liu avatar silan-liu commented on August 23, 2024
let xcode_colors = getenv("XcodeColors")
 if strcmp(xcode_colors, "YES") == 0 {
     return true
}
return false

try this

from xcodecolors.

jacobjohnston avatar jacobjohnston commented on August 23, 2024

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?

from xcodecolors.

jacobjohnston avatar jacobjohnston commented on August 23, 2024

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?

from xcodecolors.

LightMan avatar LightMan commented on August 23, 2024

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;
        }

from xcodecolors.

nesevis avatar nesevis commented on August 23, 2024

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?

from xcodecolors.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.