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!
*
* 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.
* 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.
Expand All @@ -28,10 +28,10 @@

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

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

// 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!
*
* 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.
* https://github.com/robbiehanson/CocoaLumberjack/wiki/GettingStarted
* https://github.com/CocoaLumberjack/CocoaLumberjack/wiki/GettingStarted
**/

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

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

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

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

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

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

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

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

asl_log(client, NULL, aslLogLevel, "%s", msg);
}
NSString *logMsg = logMessage->logMsg;

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

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

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

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

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

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

@end
28 changes: 14 additions & 14 deletions Vendor/CocoaLumberjack/DDAbstractDatabaseLogger.h 100644 → 100755
Expand Up @@ -6,10 +6,10 @@
* Welcome to Cocoa Lumberjack!
*
* 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.
* https://github.com/robbiehanson/CocoaLumberjack/wiki/GettingStarted
* https://github.com/CocoaLumberjack/CocoaLumberjack/wiki/GettingStarted
*
*
* This class provides an abstract implementation of a database logger.
Expand All @@ -21,18 +21,18 @@

@interface DDAbstractDatabaseLogger : DDAbstractLogger {
@protected
NSUInteger saveThreshold;
NSTimeInterval saveInterval;
NSTimeInterval maxAge;
NSTimeInterval deleteInterval;
BOOL deleteOnEverySave;
BOOL saveTimerSuspended;
NSUInteger unsavedCount;
dispatch_time_t unsavedTime;
dispatch_source_t saveTimer;
dispatch_time_t lastDeleteTime;
dispatch_source_t deleteTimer;
NSUInteger saveThreshold;
NSTimeInterval saveInterval;
NSTimeInterval maxAge;
NSTimeInterval deleteInterval;
BOOL deleteOnEverySave;
BOOL saveTimerSuspended;
NSUInteger unsavedCount;
dispatch_time_t unsavedTime;
dispatch_source_t saveTimer;
dispatch_time_t lastDeleteTime;
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.