Skip to content

Commit

Permalink
Upgraded CocoaLumberjack to version 1.8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
dirtyhenry committed May 22, 2014
1 parent 1644a21 commit 7121f87
Show file tree
Hide file tree
Showing 21 changed files with 4,713 additions and 4,032 deletions.
8 changes: 4 additions & 4 deletions Vendor/CocoaLumberjack/DDASLLogger.h
Expand Up @@ -7,10 +7,10 @@
* Welcome to Cocoa Lumberjack! * Welcome to Cocoa Lumberjack!
* *
* The project page has a wealth of documentation if you have any questions. * The project page has a wealth of documentation if you have any questions.
* https://github.com/robbiehanson/CocoaLumberjack * https://github.com/CocoaLumberjack/CocoaLumberjack
* *
* If you're new to the project you may wish to read the "Getting Started" wiki. * If you're new to the project you may wish to read the "Getting Started" wiki.
* https://github.com/robbiehanson/CocoaLumberjack/wiki/GettingStarted * https://github.com/CocoaLumberjack/CocoaLumberjack/wiki/GettingStarted
* *
* *
* This class provides a logger for the Apple System Log facility. * This class provides a logger for the Apple System Log facility.
Expand All @@ -28,10 +28,10 @@


@interface DDASLLogger : DDAbstractLogger <DDLogger> @interface DDASLLogger : DDAbstractLogger <DDLogger>
{ {
aslclient client; aslclient client;
} }


+ (DDASLLogger *)sharedInstance; + (instancetype)sharedInstance;


// Inherited from DDAbstractLogger // Inherited from DDAbstractLogger


Expand Down
101 changes: 51 additions & 50 deletions Vendor/CocoaLumberjack/DDASLLogger.m
Expand Up @@ -6,10 +6,10 @@
* Welcome to Cocoa Lumberjack! * Welcome to Cocoa Lumberjack!
* *
* The project page has a wealth of documentation if you have any questions. * The project page has a wealth of documentation if you have any questions.
* https://github.com/robbiehanson/CocoaLumberjack * https://github.com/CocoaLumberjack/CocoaLumberjack
* *
* If you're new to the project you may wish to read the "Getting Started" wiki. * If you're new to the project you may wish to read the "Getting Started" wiki.
* https://github.com/robbiehanson/CocoaLumberjack/wiki/GettingStarted * https://github.com/CocoaLumberjack/CocoaLumberjack/wiki/GettingStarted
**/ **/


#if ! __has_feature(objc_arc) #if ! __has_feature(objc_arc)
Expand All @@ -31,69 +31,70 @@ @implementation DDASLLogger
**/ **/
+ (void)initialize + (void)initialize
{ {
static BOOL initialized = NO; static BOOL initialized = NO;
if (!initialized) if (!initialized)
{ {
initialized = YES; initialized = YES;
sharedInstance = [[DDASLLogger alloc] init]; sharedInstance = [[[self class] alloc] init];
} }
} }


+ (DDASLLogger *)sharedInstance + (instancetype)sharedInstance
{ {
return sharedInstance; return sharedInstance;
} }


- (id)init - (id)init
{ {
if (sharedInstance != nil) if (sharedInstance != nil)
{ {
return nil; return nil;
} }
if ((self = [super init])) if ((self = [super init]))
{ {
// A default asl client is provided for the main thread, // A default asl client is provided for the main thread,
// but background threads need to create their own client. // but background threads need to create their own client.
client = asl_open(NULL, "com.apple.console", 0); client = asl_open(NULL, "com.apple.console", 0);
} }
return self; return self;
} }


- (void)logMessage:(DDLogMessage *)logMessage - (void)logMessage:(DDLogMessage *)logMessage
{ {
NSString *logMsg = logMessage->logMsg; NSString *logMsg = logMessage->logMsg;


if (formatter) if (formatter)
{ {
logMsg = [formatter formatLogMessage:logMessage]; logMsg = [formatter formatLogMessage:logMessage];
} }


if (logMsg) if (logMsg)
{ {
const char *msg = [logMsg UTF8String]; const char *msg = [logMsg UTF8String];


int aslLogLevel; int aslLogLevel;
switch (logMessage->logFlag) switch (logMessage->logFlag)
{ {
// Note: By default ASL will filter anything above level 5 (Notice). // Note: By default ASL will filter anything above level 5 (Notice).
// So our mappings shouldn't go above that level. // So our mappings shouldn't go above that level.


case LOG_FLAG_ERROR : aslLogLevel = ASL_LEVEL_CRIT; break; case LOG_FLAG_ERROR : aslLogLevel = ASL_LEVEL_ALERT; break;
case LOG_FLAG_WARN : aslLogLevel = ASL_LEVEL_ERR; break; case LOG_FLAG_WARN : aslLogLevel = ASL_LEVEL_CRIT; break;
case LOG_FLAG_INFO : aslLogLevel = ASL_LEVEL_WARNING; break; case LOG_FLAG_INFO : aslLogLevel = ASL_LEVEL_ERR; break;
default : aslLogLevel = ASL_LEVEL_NOTICE; break; case LOG_FLAG_DEBUG : aslLogLevel = ASL_LEVEL_WARNING; break;
} default : aslLogLevel = ASL_LEVEL_NOTICE; break;

}
asl_log(client, NULL, aslLogLevel, "%s", msg);
} asl_log(client, NULL, aslLogLevel, "%s", msg);
}
} }


- (NSString *)loggerName - (NSString *)loggerName
{ {
return @"cocoa.lumberjack.aslLogger"; return @"cocoa.lumberjack.aslLogger";
} }


@end @end
28 changes: 14 additions & 14 deletions Vendor/CocoaLumberjack/DDAbstractDatabaseLogger.h 100644 → 100755
Expand Up @@ -6,10 +6,10 @@
* Welcome to Cocoa Lumberjack! * Welcome to Cocoa Lumberjack!
* *
* The project page has a wealth of documentation if you have any questions. * The project page has a wealth of documentation if you have any questions.
* https://github.com/robbiehanson/CocoaLumberjack * https://github.com/CocoaLumberjack/CocoaLumberjack
* *
* If you're new to the project you may wish to read the "Getting Started" wiki. * If you're new to the project you may wish to read the "Getting Started" wiki.
* https://github.com/robbiehanson/CocoaLumberjack/wiki/GettingStarted * https://github.com/CocoaLumberjack/CocoaLumberjack/wiki/GettingStarted
* *
* *
* This class provides an abstract implementation of a database logger. * This class provides an abstract implementation of a database logger.
Expand All @@ -21,18 +21,18 @@


@interface DDAbstractDatabaseLogger : DDAbstractLogger { @interface DDAbstractDatabaseLogger : DDAbstractLogger {
@protected @protected
NSUInteger saveThreshold; NSUInteger saveThreshold;
NSTimeInterval saveInterval; NSTimeInterval saveInterval;
NSTimeInterval maxAge; NSTimeInterval maxAge;
NSTimeInterval deleteInterval; NSTimeInterval deleteInterval;
BOOL deleteOnEverySave; BOOL deleteOnEverySave;
BOOL saveTimerSuspended; BOOL saveTimerSuspended;
NSUInteger unsavedCount; NSUInteger unsavedCount;
dispatch_time_t unsavedTime; dispatch_time_t unsavedTime;
dispatch_source_t saveTimer; dispatch_source_t saveTimer;
dispatch_time_t lastDeleteTime; dispatch_time_t lastDeleteTime;
dispatch_source_t deleteTimer; dispatch_source_t deleteTimer;
} }


/** /**
Expand Down

4 comments on commit 7121f87

@jonasman
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, after this update XMPPLoging is not working. any ideas?

@ObjColumnist
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure set a log level when you add a logger:

    [DDLog addLogger:[DDTTYLogger sharedInstance] withLogLevel:XMPP_LOG_FLAG_SEND_RECV];

@jonasman
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[DDLog addLogger:[DDTTYLogger sharedInstance] withLogLevel:XMPP_LOG_LEVEL_VERBOSE];

I tried this still not working.

EDIT: With your flag now works.

@ObjColumnist
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Glad you got it working, I had the same issue 😄

Please sign in to comment.