Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleanup + a few additions, ReactiveCocoa extensions, etc.
- Loading branch information
1 parent
d3c92f1
commit 343ef0f
Showing
15 changed files
with
423 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "Classes/RRFPSBar"] | ||
path = Classes/RRFPSBar | ||
url = git://github.com/RolandasRazma/RRFPSBar.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,22 @@ | ||
// | ||
// BrynKitDDLogColorFormatter.h | ||
// BrynKit | ||
// | ||
// Created by bryn austin bellomy on 2/27/2013. | ||
// Copyright (c) 2013 bryn austin bellomy. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import <CocoaLumberjack/DDLog.h> | ||
|
||
|
||
@interface BrynKitDDLogColorFormatter : NSObject <DDLogFormatter> | ||
{ | ||
int atomicLoggerCount; | ||
NSDateFormatter *threadUnsafeDateFormatter; | ||
} | ||
|
||
@property (atomic, assign, readwrite) BOOL shouldPrintDispatchQueueLabel; | ||
@property (atomic, assign, readwrite) BOOL shouldPrintLogLevel; | ||
@property (atomic, assign, readwrite) BOOL shouldPrintMostLikelyClassname; | ||
@property (atomic, assign, readwrite) BOOL shouldPrintMethodName; | ||
@property (atomic, assign, readwrite) BOOL shouldFilterByLogContext; | ||
@property (atomic, strong, readwrite) NSArray *acceptableLogContexts; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,114 @@ | ||
// | ||
// BrynKitDDLogColorFormatter.m | ||
// BrynKit | ||
// | ||
// Created by bryn austin bellomy on 2/27/2013. | ||
// Copyright (c) 2013 bryn austin bellomy. All rights reserved. | ||
// | ||
|
||
#import <CocoaLumberjack/DDLog.h> | ||
|
||
#import "BrynKitCocoaLumberjack.h" | ||
#import "BrynKitLogging.h" | ||
#import "BrynKitDDLogColorFormatter.h" | ||
|
||
@implementation BrynKitDDLogColorFormatter | ||
|
||
- (NSString *)formatLogMessage:(DDLogMessage *)logMessage | ||
/** | ||
* init | ||
* | ||
* @return {instancetype} | ||
*/ | ||
- (instancetype) init | ||
{ | ||
NSString *colorized; | ||
switch (logMessage->logFlag) | ||
{ | ||
case LOG_FLAG_ERROR: colorized = [NSString stringWithFormat:COLOR_ERROR(@"[ERROR] %@"), logMessage->logMsg]; break; | ||
case LOG_FLAG_WARN: colorized = [NSString stringWithFormat:COLOR_WARN(@"[WARN] %@"), logMessage->logMsg]; break; | ||
case LOG_FLAG_INFO: colorized = [NSString stringWithFormat:COLOR_INFO(@"[INFO] %@"), logMessage->logMsg]; break; | ||
case LOG_FLAG_VERBOSE: colorized = [NSString stringWithFormat:COLOR_VERBOSE(@"[VERBOSE] %@"), logMessage->logMsg]; break; | ||
default: colorized = logMessage->logMsg; break; | ||
self = [super init]; | ||
|
||
if (self) { | ||
_shouldPrintDispatchQueueLabel = YES; | ||
_shouldPrintLogLevel = YES; | ||
_shouldPrintMostLikelyClassname = YES; | ||
_shouldPrintMethodName = YES; | ||
_shouldFilterByLogContext = NO; | ||
} | ||
|
||
NSString *colorFunc = [NSString stringWithFormat: @"[" COLOR_ORANGE(@"%s") @"]" COLOR_SEL(@"%@ %@"), logMessage->queueLabel, logMessage.fileName, logMessage.methodName]; | ||
return [NSString stringWithFormat:@"%@ %@", colorFunc, colorized]; | ||
return self; | ||
} | ||
|
||
|
||
@end | ||
|
||
/** | ||
* formatLogMessage: | ||
* | ||
* @param {DDLogMessage*} logMessage | ||
* @return {NSString*} | ||
*/ | ||
- (NSString *) formatLogMessage: (DDLogMessage *)logMessage | ||
{ | ||
if (self.shouldFilterByLogContext && (self.acceptableLogContexts != nil)) { | ||
BOOL found = NO; | ||
|
||
for (NSNumber *num in self.acceptableLogContexts) { | ||
if (num.intValue == logMessage->logContext) { | ||
found = YES; | ||
break; | ||
} | ||
} | ||
|
||
if (NO == found) { | ||
return nil; | ||
} | ||
} | ||
|
||
NSString *logMessageColorized; | ||
NSString *logLevel = @"N/A"; | ||
switch (logMessage->logFlag) { | ||
case LOG_FLAG_ERROR: | ||
logMessageColorized = [NSString stringWithFormat: COLOR_ERROR(@"%@"), logMessage->logMsg]; logLevel = COLOR_ERROR(@"ERROR"); break; | ||
|
||
case LOG_FLAG_SUCCESS: | ||
logMessageColorized = [NSString stringWithFormat: COLOR_SUCCESS(@"%@"), logMessage->logMsg]; logLevel = COLOR_SUCCESS(@"SUCCESS"); break; | ||
|
||
case LOG_FLAG_WARN: | ||
logMessageColorized = [NSString stringWithFormat: COLOR_WARN(@"%@"), logMessage->logMsg]; logLevel = COLOR_WARN(@"WARN"); break; | ||
|
||
case LOG_FLAG_INFO: | ||
logMessageColorized = [NSString stringWithFormat: COLOR_INFO(@"%@"), logMessage->logMsg]; logLevel = COLOR_INFO(@"INFO"); break; | ||
|
||
case LOG_FLAG_VERBOSE: | ||
logMessageColorized = [NSString stringWithFormat: COLOR_VERBOSE(@"%@"), logMessage->logMsg]; logLevel = COLOR_VERBOSE(@"VERBOSE"); break; | ||
|
||
default: | ||
logMessageColorized = logMessage->logMsg; break; | ||
} | ||
|
||
NSMutableArray *parts = NSMutableArray.array; | ||
|
||
if (self.shouldPrintDispatchQueueLabel) { | ||
[parts addObject: [NSString stringWithFormat: COLOR_QUEUE(@"%s"), logMessage->queueLabel]]; | ||
} | ||
|
||
if (self.shouldPrintMethodName) { | ||
NSMutableArray *methodNameParts = @[].mutableCopy; | ||
|
||
if (self.shouldPrintMostLikelyClassname) { | ||
[methodNameParts addObject: logMessage.fileName]; | ||
} | ||
|
||
[methodNameParts addObject: logMessage.methodName]; | ||
NSString *methodName = [methodNameParts componentsJoinedByString: @" "]; | ||
|
||
[parts addObject: [NSString stringWithFormat: COLOR_SEL(@"%@"), methodName]]; | ||
} | ||
|
||
if (self.shouldPrintLogLevel) { | ||
[parts addObject: [NSString stringWithFormat: @"[%@]", logLevel]]; | ||
} | ||
|
||
[parts addObject: logMessageColorized]; | ||
|
||
return [parts componentsJoinedByString: @" "]; | ||
} | ||
|
||
|
||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// | ||
// RACScheduler+SECriticalSectionScheduler.h | ||
// Stan | ||
// | ||
// Created by bryn austin bellomy on 3.12.13. | ||
// Copyright (c) 2013 robot bubble bath LLC. All rights reserved. | ||
// | ||
|
||
#import <BrynKit/GCDThreadsafe.h> | ||
#import "RACScheduler.h" | ||
|
||
@interface RACScheduler (SECriticalSectionScheduler) | ||
|
||
+ (RACScheduler *) rac_criticalSectionSchedulerFor:(id<GCDThreadsafe>)object; | ||
|
||
@end |
Oops, something went wrong.