Skip to content
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

Fixing xcode project & install script. And adding support for full color spectrum. #1

Open
wants to merge 114 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
114 commits
Select commit Hold shift + click to select a range
69a989c
Validating project settings (updating base sdk to "latest")
robbiehanson May 22, 2012
9b056ee
Removing outdated / unnecessary settings
robbiehanson May 22, 2012
53409ed
Updating deployment target to 10.6
robbiehanson May 22, 2012
207276f
Removing code signing identity
robbiehanson May 22, 2012
278c4d3
Fixing install script
robbiehanson May 22, 2012
74e1367
Support full color spectrum by allowing rgb values to be directly pas…
robbiehanson May 22, 2012
9245ef5
Adding TestXcodeColors demo target
robbiehanson May 22, 2012
9bce178
Removing unnecessary script
robbiehanson May 22, 2012
094d108
Updating README file with installation instructions
robbiehanson May 22, 2012
6847d12
Prefixing define's with "XCODE_COLORS"
robbiehanson May 24, 2012
7b44a23
Updating README, and converting it to markdown
robbiehanson May 24, 2012
108d610
Updating README instructions
robbiehanson May 24, 2012
f1ae31f
Updating installation instructions (gdb stuff isn't necessary for Xco…
robbiehanson May 25, 2012
c35c67a
Updating description to better describe what it does.
robbiehanson May 25, 2012
c6e304e
Tweaking README markdown
robbiehanson May 25, 2012
72a472e
Bug fix when running on iOS device (XCODE_COLORS_ESCAPE_IOS wasn't wo…
robbiehanson Jun 1, 2012
158c02b
Updating README
robbiehanson Jun 1, 2012
d51c694
change default scheme from 'debug' to 'release'
demonnico Sep 25, 2013
5ff288d
remove unused 'version.plist
demonnico Sep 25, 2013
3a0ce50
support to xcode5
demonnico Sep 25, 2013
2bf362e
Merge pull request #4 from demon1105/master
robbiehanson Sep 26, 2013
c8b1d6c
Replaced install script with simple compiler directives. (thanks mral…
robbiehanson Sep 26, 2013
3e95201
Removing unused files
robbiehanson Sep 26, 2013
bbd1d43
Switching build configurations from Debug/Release to Xcode4/Xcode5. (…
robbiehanson Sep 26, 2013
0390674
Adding XcodeColors plugin as a dependency of the TestXcodeColors targ…
robbiehanson Sep 26, 2013
05853cf
File system organization
robbiehanson Sep 26, 2013
11041fb
Update README.markdown
robbiehanson Sep 26, 2013
997084a
Update README.markdown
robbiehanson Sep 26, 2013
4169c6f
Adding sample macro to test code
robbiehanson Sep 26, 2013
2bf4e18
TextXcodeColors: applicationShouldTerminateAfterLastWindowClosed YES
isghe Dec 9, 2013
007b8a6
fix typo
rochefort Dec 28, 2013
59a808f
Merge pull request #5 from isghe/applicationShouldTerminateAfterLastW…
robbiehanson Feb 5, 2014
ddef65c
Merge pull request #6 from rochefort/fixtypo
robbiehanson Feb 5, 2014
e76f4d6
Update README.markdown
robbiehanson Feb 5, 2014
752aaf9
Minor (inconsequential) changes.
robbiehanson Feb 5, 2014
081ed47
Merge branch 'master' of github.com:robbiehanson/XcodeColors
robbiehanson Feb 5, 2014
fa51203
Adding support for Xcode 5.1 Beta 5
robbiehanson Feb 5, 2014
ac0695e
Update README.markdown
robbiehanson Feb 5, 2014
d84a8b5
Add support for Xcode 5.1
tomhamming Mar 10, 2014
5b8da92
Merge pull request #7 from tomhamming/master
robbiehanson Mar 11, 2014
bb0e486
Remove unneeded log statements
gfontenot Mar 21, 2014
727411b
Add support for Xcode 6
Jun 20, 2014
7a02035
Merge pull request #11 from kernandreas/master
robbiehanson Aug 11, 2014
a88b7a8
Dropping Xcode 4 support. This was causing a lot of people confusion …
robbiehanson Aug 11, 2014
4fa15db
Merge pull request #9 from gfontenot/master
robbiehanson Aug 11, 2014
f7d4b9c
Added support for Xcode 6 GM
NachoSoto Sep 9, 2014
1724a2c
Merge pull request #14 from NachoSoto/master
robbiehanson Sep 9, 2014
fe992e7
Added Swift version
klaas Sep 23, 2014
66d4ab3
Fix for crash when inspecting details of an Xcode Server Bot
Oct 8, 2014
b55e0f0
Added support for Xcode 6.2 beta (6C86e)
cjwirth Nov 28, 2014
2b11f7e
Merge pull request #24 from cjwirth/feature/xcode-6_2b
robbiehanson Dec 2, 2014
058b646
Merge pull request #16 from klaas/patch-1
robbiehanson Dec 2, 2014
a08ac35
Merge branch 'xcode6-bots-fix' of https://github.com/n8gray/XcodeColo…
robbiehanson Dec 2, 2014
bc2e4f9
Added UUID of new xcode beta 6.3
Feb 10, 2015
d2d4430
Update readme
rvi Feb 19, 2015
1b733d9
Xcode Version 6.2 (6C131e) support.
pwnified Mar 9, 2015
8b8eaca
Merge pull request #30 from pwnified/master
robbiehanson Mar 11, 2015
e5718ed
Merge branch 'xcode-6.3-beta-1' of https://github.com/Reflejo/XcodeCo…
robbiehanson Mar 11, 2015
0bb72a9
Merge branch 'readmeUpdate-1' of https://github.com/rvi/XcodeColors i…
robbiehanson Mar 11, 2015
9755be1
Fixing compiler warnings. And restoring hook methods (for possible fu…
robbiehanson Mar 11, 2015
d7b2396
Xcode Version 6.3 (6D570) support.
pwnified Apr 9, 2015
1a7579f
Merge branch 'master' of https://github.com/robbiehanson/XcodeColors
pwnified Apr 9, 2015
3b11f5c
Merge pull request #34 from pwnified/master
robbiehanson Apr 9, 2015
0ae8e5f
Add DVTPlugInCompatibilityUUIDs for Xcode 6.4 betas 1, 2.
kreeger Apr 30, 2015
70ffbae
Merge pull request #37 from kreeger/feature/xcode-64-beta-compatibility
robbiehanson Apr 30, 2015
b419689
Update README.markdown
robbiehanson Apr 30, 2015
fcfb22f
Add compatibility UUID for Xcode 6.3.2.
kreeger May 8, 2015
8043721
Merge pull request #38 from kreeger/feature/xcode-6.3.2-compatibility
robbiehanson May 9, 2015
8ba88fb
Update for Xcode 6.3
Dwarven May 19, 2015
fa60538
Merge pull request #39 from Dwarven/master
robbiehanson May 19, 2015
b4eb87b
Added "AABB7188-E14E-4433-AD3B-5CD791EAD9A3" to DVTPlugInCompatibilit…
Norod Jun 9, 2015
af56330
Merge pull request #41 from Norod/Support-Xcode7-Beta-1
robbiehanson Jun 9, 2015
fd5006c
Add Xcode 6.4b4 compat UUID.
kreeger Jun 30, 2015
87ed272
Add UUID for Xcode 6.4 compatibility.
kreeger Jun 30, 2015
3618a55
Merge pull request #42 from kreeger/feature/xcode-6.4-compat
robbiehanson Jun 30, 2015
bbbe6bb
add script to update Xcode compatibility
zlargon Jun 30, 2015
b142233
Update for Xcode 6.4
Dwarven Jul 2, 2015
e93ece3
Merge pull request #43 from zlargon/script-for-update-plist-info
robbiehanson Jul 2, 2015
bdb7a6a
Merge pull request #45 from Dwarven/master
robbiehanson Jul 2, 2015
4e933c4
Fixing update_compat.sh script.
robbiehanson Jul 2, 2015
4fab1a6
[fix bug] replace '$plist' to "$plist" in update_compat.sh
zlargon Jul 3, 2015
629eccf
Merge pull request #46 from zlargon/fix-script-bug
robbiehanson Jul 3, 2015
ce2b8a3
Update for Xcode 7 GM Seed
cjwirth Sep 10, 2015
1e7fc59
Merge pull request #52 from cjwirth/master
robbiehanson Sep 10, 2015
15f03d6
Added support for Xcode 7.1 beta (7B60)
DanSkeel Sep 10, 2015
521ca95
Corrects minor typo: it's --> its
AmitaiB Sep 22, 2015
891ba2a
Merge pull request #56 from AmitaiB/patch-1
robbiehanson Sep 22, 2015
c5b2b35
Merge pull request #53 from DanSkeel/master
robbiehanson Sep 22, 2015
503d0b9
Merge commit 'c5b2b3599f7f2f7d1561d5c9f3543a080a8abb51'
DanSkeel Oct 22, 2015
8a47a73
Added support for Xcode 7.1 Build version 7B91b
DanSkeel Oct 22, 2015
970bb0a
Fix "use of undeclared identifier" error
jawwad Oct 22, 2015
4d41c53
Update println to print for Swift 2.0
jawwad Oct 22, 2015
ac242ad
Merge pull request #62 from DanSkeel/Xcode7.1_7B91b
robbiehanson Oct 22, 2015
5028d2d
Merge pull request #64 from jawwad/patch-3
robbiehanson Oct 22, 2015
c038b60
Merge pull request #63 from jawwad/patch-2
robbiehanson Oct 22, 2015
796faa8
Performing recommended project changes for Xcode 7.
robbiehanson Oct 22, 2015
3d7197b
Adding mention of Xcode 7 to readme.
robbiehanson Oct 22, 2015
0ac37f4
Updating bundle identifier.
robbiehanson Oct 22, 2015
d5ae611
Merge robbiehanson/master into danskeel/master
DanSkeel Oct 23, 2015
3050baa
Converted plist file back to XML format
DanSkeel Oct 23, 2015
f089175
Merge pull request #65 from DanSkeel/fix_binary_plist
robbiehanson Oct 23, 2015
364d6c4
Readme: Update redirects
ReadmeCritic Nov 10, 2015
ca37604
Merge pull request #68 from ReadmeCritic/master
robbiehanson Nov 10, 2015
0d2f7aa
XCode Version 7.2 (7C68) release
tommeier Dec 9, 2015
a65988a
Merge pull request #70 from tommeier/xcode7.2
robbiehanson Dec 9, 2015
5ce04b3
Fix update_compat tool to output plist in XML format to make the diff…
robbiehanson Dec 10, 2015
ba9ccdb
Convert Info.plist back to XML.
robbiehanson Dec 10, 2015
f6cf98d
Add reference to CleanroomLogger
Dec 30, 2015
d9bc43a
Add check for Xcode-beta
ctgreybeard Jan 28, 2016
f0b7c64
XCode 7.3 (7D175) added
tommeier Mar 22, 2016
c4447d0
Merge pull request #80 from tommeier/xcode7.3
robbiehanson Mar 27, 2016
d55c77b
Merge pull request #77 from ctgreybeard/Update-beta
robbiehanson Mar 27, 2016
eb4bd15
Merge pull request #74 from emaloney/master
robbiehanson Mar 27, 2016
d2f119b
Update README.markdown
robbiehanson Mar 27, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 0 additions & 37 deletions MethodReplace.h

This file was deleted.

42 changes: 0 additions & 42 deletions MethodReplace.m

This file was deleted.

4 changes: 0 additions & 4 deletions README

This file was deleted.

259 changes: 259 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,259 @@
XcodeColors allows you to use colors in the Xcode debugging console.
It's designed to aid in the debugging process. For example:
- Make error messages stand out by printing them out in red.
- Use different colors for logically separate parts of your code.

You're not limited to a restricted color palate.
You can specify, in your source code, the exact RGB values you'd like to use.
You can specify foreground and/or background color(s).

XcodeColors is a simple plugin for Xcode 3, 4, 5, 6 & 7

***

### XcodeColors installation instructions for Xcode 4, 5, 6 & 7:

- Download or clone the repository.
- Open the XcodeColors project with Xcode
- If compiling for Xcode 4, then change the schemes to use the Xcode4 build configuration (instead of the Xcode5 build configuration which is the default)
- Compile the XcodeColors target.
When you do this, the Xcode plugin is automatically copied to the proper location.
This is done via the build settings.
You can validate the plugin was copied to "~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/XcodeColors.xcplugin"
- Now completely Quit Xcode
- Re-Launch Xcode, and re-open the XcodeColors project
- Now run the TestXcodeColors target.
This will test your installation, and you should see colors in your Xcode console.

Did you **upgrade Xcode** and now XcodeColors is **"broken"**? Get the fix here: **[XcodeUpdates](https://github.com/robbiehanson/XcodeColors/wiki/XcodeUpdates)**.

```
$ ./update_compat.sh
```

### XcodeColors installation instructions for Xcode 3:

Wow, you're still running Xcode 3?

See this page for installation instructions:
http://deepitpro.com/en/articles/XcodeColors/info/index.shtml

***

### How to use XcodeColors

**There are 3 ways to use XcodeColors:**

1. [**Manually specify the colors inside NSLog (or create custom macros)**](#option-1-manual-use--custom-macros)
2. [**Use CocoaLumberjack**](#option-2-cocoalumberjack) (for Objective-C & Swift projects)
3. [**Use CleanroomLogger**](#option-3-cleanroomlogger) (for Swift projects)

***

### Option 1: Manual Use / Custom Macros

- Testing to see if XcodeColors is installed and enabled:

```objective-c
char *xcode_colors = getenv("XcodeColors");
if (xcode_colors && (strcmp(xcode_colors, "YES") == 0))
{
// XcodeColors is installed and enabled!
}
```

- Enabling / Disabling XcodeColors

```objective-c
setenv("XcodeColors", "YES", 0); // Enables XcodeColors (you obviously have to install it too)

setenv("XcodeColors", "NO", 0); // Disables XcodeColors
```

- Using XcodeColors

The following is copied from the top of the XcodeColors.m file:

```objective-c
// How to apply color formatting to your log statements:
//
// To set the foreground color:
// Insert the ESCAPE into your string, followed by "fg124,12,255;" where r=124, g=12, b=255.
//
// To set the background color:
// Insert the ESCAPE into your string, followed by "bg12,24,36;" where r=12, g=24, b=36.
//
// To reset the foreground color (to default value):
// Insert the ESCAPE into your string, followed by "fg;"
//
// To reset the background color (to default value):
// Insert the ESCAPE into your string, followed by "bg;"
//
// To reset the foreground and background color (to default values) in one operation:
// Insert the ESCAPE into your string, followed by ";"

#define XCODE_COLORS_ESCAPE @"\033["

#define XCODE_COLORS_RESET_FG XCODE_COLORS_ESCAPE @"fg;" // Clear any foreground color
#define XCODE_COLORS_RESET_BG XCODE_COLORS_ESCAPE @"bg;" // Clear any background color
#define XCODE_COLORS_RESET XCODE_COLORS_ESCAPE @";" // Clear any foreground or background color
```

To manually colorize your log statements, you surround the log statements with the color options:

```objective-c
NSLog(XCODE_COLORS_ESCAPE @"fg0,0,255;" @"Blue text" XCODE_COLORS_RESET);

NSLog(XCODE_COLORS_ESCAPE @"bg220,0,0;" @"Red background" XCODE_COLORS_RESET);

NSLog(XCODE_COLORS_ESCAPE @"fg0,0,255;"
XCODE_COLORS_ESCAPE @"bg220,0,0;"
@"Blue text on red background"
XCODE_COLORS_RESET);

NSLog(XCODE_COLORS_ESCAPE @"fg209,57,168;" @"You can supply your own RGB values!" XCODE_COLORS_RESET);
```

- Defining macros

You may prefer to use macros to keep your code looking a bit cleaner.
Here's an example to get you started:

```objective-c
#define LogBlue(frmt, ...) NSLog((XCODE_COLORS_ESCAPE @"fg0,0,255;" frmt XCODE_COLORS_RESET), ##__VA_ARGS__)
#define LogRed(frmt, ...) NSLog((XCODE_COLORS_ESCAPE @"fg255,0,0;" frmt XCODE_COLORS_RESET), ##__VA_ARGS__)
```

And then you could just replace NSLog with LogBlue like so:

```objective-c
LogBlue(@"Configuring sprocket...");
LogRed(@"Sprocket error: %@", error);
```

- Swift struct with static methods

```swift
struct ColorLog {
static let ESCAPE = "\u{001b}["

static let RESET_FG = ESCAPE + "fg;" // Clear any foreground color
static let RESET_BG = ESCAPE + "bg;" // Clear any background color
static let RESET = ESCAPE + ";" // Clear any foreground or background color

static func red<T>(object: T) {
print("\(ESCAPE)fg255,0,0;\(object)\(RESET)")
}

static func green<T>(object: T) {
print("\(ESCAPE)fg0,255,0;\(object)\(RESET)")
}

static func blue<T>(object: T) {
print("\(ESCAPE)fg0,0,255;\(object)\(RESET)")
}

static func yellow<T>(object: T) {
print("\(ESCAPE)fg255,255,0;\(object)\(RESET)")
}

static func purple<T>(object: T) {
print("\(ESCAPE)fg255,0,255;\(object)\(RESET)")
}

static func cyan<T>(object: T) {
print("\(ESCAPE)fg0,255,255;\(object)\(RESET)")
}
}
```
And then you can log within a Swift method like so:

```Swift
ColorLog.red("This is a log.")
ColorLog.blue("Number one hundred: \(100).")
```

***

### Option 2: CocoaLumberjack

The [CocoaLumberjack](https://github.com/CocoaLumberjack/CocoaLumberjack) framework natively supports XcodeColors!
Lumberjack is a fast & simple, yet powerful & flexible logging framework for Mac and iOS.

From its GitHub page:

> Lumberjack is similar in concept to other popular logging frameworks such as log4j,
> yet is designed specifically for Objective-C, and takes advantage of features such as
> multi-threading, grand central dispatch (if available), lockless atomic operations,
> and the dynamic nature of the Objective-C runtime.
>
> In most cases it is an order of magnitude faster than NSLog.

It's super easy to use XcodeColors with Lumberjack!

And if color isn't available (e.g. XcodeColors isn't installed), then the framework just automatically does the right thing. So if you install XcodeColors on your machine, and enable colors in your team project, your teammates (without XcodeColors... yet) won't suffer, or even notice.

Plus Lumberjack colors automatically work if you run your application from within a terminal! (E.g. Terminal.app, not Xcode) If your terminal supports color (xterm-color or xterm-256color) like the Terminal.app in Lion, then Lumberjack automatically maps your color customizations to the closest available color supported by the shell!

```objective-c
// Enable XcodeColors
setenv("XcodeColors", "YES", 0);

// Standard lumberjack initialization
[DDLog addLogger:[DDTTYLogger sharedInstance]];

// And then enable colors
[[DDTTYLogger sharedInstance] setColorsEnabled:YES];

// Check out default colors:
// Error : Red
// Warn : Orange

DDLogError(@"Paper jam"); // Red
DDLogWarn(@"Toner is low"); // Orange
DDLogInfo(@"Warming up printer (pre-customization)"); // Default (black)
DDLogVerbose(@"Intializing protcol x26"); // Default (black)

// Now let's do some customization:
// Info : Pink

#if TARGET_OS_IPHONE
UIColor *pink = [UIColor colorWithRed:(255/255.0) green:(58/255.0) blue:(159/255.0) alpha:1.0];
#else
NSColor *pink = [NSColor colorWithCalibratedRed:(255/255.0) green:(58/255.0) blue:(159/255.0) alpha:1.0];
#endif

[[DDTTYLogger sharedInstance] setForegroundColor:pink backgroundColor:nil forFlag:DDLogFlagInfo];

DDLogInfo(@"Warming up printer (post-customization)"); // Pink !
```

***

### Option 3: CleanroomLogger

[CleanroomLogger](https://github.com/emaloney/CleanroomLogger) is a popular pure-Swift logging API for iOS, Mac OS X, tvOS and watchOS that is designed to be simple, extensible, lightweight and performant.

CleanroomLogger is a *real* console logger, meaning that it writes to the Apple System Log (ASL) facility and not just to standard output.

[XcodeColors support](https://github.com/emaloney/CleanroomLogger#xcodecolors-support) is included in CleanroomLogger, and by default, when the `XcodeColors` environment variable is set to `YES`, CleanroomLogger will colorize log output based on the [*severity*](https://rawgit.com/emaloney/CleanroomLogger/master/Documentation/API/Enums/LogSeverity.html) of the message:

<img alt="CleanroomLogger's default XcodeColors log severity colorization" src="https://raw.githubusercontent.com/emaloney/CleanroomLogger/master/Documentation/Images/XcodeColors-sample.png" width="695" height="120"/>

Let's say you had an `AppDelegate.swift` file with an `import CleanroomLogger` statement and the lines:

```swift
Log.verbose?.trace()
Log.debug?.value(self)
Log.info?.message("These pretzels are making me thirsty")
Log.warning?.message("The ocean called, they're running out of shrimp!")
Log.error?.message("The database connection failed")
```

With CleanroomLogger and XcodeColors, you would see colorized log output looking something like:

<img alt="CleanroomLogger code example" src="https://raw.githubusercontent.com/emaloney/CleanroomLogger/master/Documentation/Images/XcodeColors-code-example.png" width="705" height="105"/>

CleanroomLogger lets developers supply their own [`ColorTable`](https://rawgit.com/emaloney/CleanroomLogger/master/Documentation/API/Protocols/ColorTable.html) to customize the default color scheme. Default colorization can also be turned off entirely, and an [`XcodeColorsColorizer`](https://rawgit.com/emaloney/CleanroomLogger/master/Documentation/API/Structs/XcodeColorsColorizer.html) instance can be used to manually apply XcodeColors escape sequences to strings.

For further details, visit [the CleanroomLogger API documentation](https://rawgit.com/emaloney/CleanroomLogger/master/Documentation/API/index.html).
8 changes: 8 additions & 0 deletions TestXcodeColors/AppDelegate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#import <Cocoa/Cocoa.h>


@interface AppDelegate : NSObject <NSApplicationDelegate>

@property (assign) IBOutlet NSWindow *window;

@end
Loading