Skip to content

Instantly share code, notes, and snippets.

@sgtsquiggs
Last active August 29, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sgtsquiggs/51b63016a763ec0a2d22 to your computer and use it in GitHub Desktop.
Save sgtsquiggs/51b63016a763ec0a2d22 to your computer and use it in GitHub Desktop.
ARAnalyticsLogger
//
// ARAnalyticsLogger.h
//
// Created by Matthew Crenshaw on 2/12/15.
// Copyright (c) 2015 Batoul Apps. All rights reserved.
//
#import <CocoaLumberjack/DDLog.h>
@interface ARAnalyticsLogger : DDAbstractLogger
+ (ARAnalyticsLogger *)sharedInstance;
@end
//
// ARAnalyticsLogger.m
//
// Created by Matthew Crenshaw on 2/12/15.
// Copyright (c) 2015 Batoul Apps. All rights reserved.
//
#import "ARAnalyticsLogger.h"
OBJC_EXTERN void ARLog (NSString *format, ...) NS_FORMAT_FUNCTION(1,2);
@implementation ARAnalyticsLogger
- (void)logMessage:(DDLogMessage *)logMessage
{
NSString *logMsg = logMessage->_message;
if (_logFormatter)
{
logMsg = [_logFormatter formatLogMessage:logMessage];
}
if (logMsg)
{
ARLog(@"%@", logMsg);
}
}
+ (ARAnalyticsLogger *) sharedInstance
{
static dispatch_once_t pred = 0;
static ARAnalyticsLogger *_sharedInstance = nil;
dispatch_once(&pred, ^{
_sharedInstance = [[self alloc] init];
});
return _sharedInstance;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment