Permalink
Browse files

Upgraded CocoaLumberjack to version 1.8.1

  • Loading branch information...
1 parent 1644a21 commit 7121f87a75a8999850d141d5f263f8aaf6d125ff @dirtyhenry dirtyhenry committed May 22, 2014
@@ -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.
@@ -28,10 +28,10 @@
@interface DDASLLogger : DDAbstractLogger <DDLogger>
{
- aslclient client;
+ aslclient client;
}
-+ (DDASLLogger *)sharedInstance;
++ (instancetype)sharedInstance;
// Inherited from DDAbstractLogger
@@ -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)
@@ -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
View
@@ -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.
@@ -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;
}
/**
Oops, something went wrong.

4 comments on commit 7121f87

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

Collaborator

ObjColumnist replied Jun 4, 2014

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

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

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

I tried this still not working.

EDIT: With your flag now works.

Collaborator

ObjColumnist replied Jun 4, 2014

👍

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

Please sign in to comment.