-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #325 from wordpress-mobile/delete-cocoalumberjack
Delete CocoaLumberjack
- Loading branch information
Showing
17 changed files
with
248 additions
and
170 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
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 was deleted.
Oops, something went wrong.
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,4 +1,21 @@ | ||
@import CocoaLumberjack; | ||
#import <Foundation/Foundation.h> | ||
#import "WordPressLoggingDelegate.h" | ||
|
||
DDLogLevel WPSharedGetLoggingLevel(void); | ||
void WPSharedSetLoggingLevel(DDLogLevel level); | ||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
FOUNDATION_EXTERN id<WordPressLoggingDelegate> _Nullable WPSharedGetLoggingDelegate(void); | ||
FOUNDATION_EXTERN void WPSharedSetLoggingDelegate(id<WordPressLoggingDelegate> _Nullable logger); | ||
|
||
FOUNDATION_EXTERN void WPSharedLogError(NSString *str, ...) NS_FORMAT_FUNCTION(1, 2); | ||
FOUNDATION_EXTERN void WPSharedLogWarning(NSString *str, ...) NS_FORMAT_FUNCTION(1, 2); | ||
FOUNDATION_EXTERN void WPSharedLogInfo(NSString *str, ...) NS_FORMAT_FUNCTION(1, 2); | ||
FOUNDATION_EXTERN void WPSharedLogDebug(NSString *str, ...) NS_FORMAT_FUNCTION(1, 2); | ||
FOUNDATION_EXTERN void WPSharedLogVerbose(NSString *str, ...) NS_FORMAT_FUNCTION(1, 2); | ||
|
||
FOUNDATION_EXTERN void WPSharedLogvError(NSString *str, va_list args) NS_FORMAT_FUNCTION(1, 0); | ||
FOUNDATION_EXTERN void WPSharedLogvWarning(NSString *str, va_list args) NS_FORMAT_FUNCTION(1, 0); | ||
FOUNDATION_EXTERN void WPSharedLogvInfo(NSString *str, va_list args) NS_FORMAT_FUNCTION(1, 0); | ||
FOUNDATION_EXTERN void WPSharedLogvDebug(NSString *str, va_list args) NS_FORMAT_FUNCTION(1, 0); | ||
FOUNDATION_EXTERN void WPSharedLogvVerbose(NSString *str, va_list args) NS_FORMAT_FUNCTION(1, 0); | ||
|
||
NS_ASSUME_NONNULL_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,15 +1,47 @@ | ||
#import "WPSharedLogging.h" | ||
|
||
#if SWIFT_PACKAGE | ||
#import "../Private/WPSharedLoggingPrivate.h" | ||
#else | ||
#import "WPSharedLoggingPrivate.h" | ||
#endif | ||
|
||
DDLogLevel WPSharedGetLoggingLevel() { | ||
return ddLogLevel; | ||
static id<WordPressLoggingDelegate> wordPressSharedLogger = nil; | ||
|
||
id<WordPressLoggingDelegate> _Nullable WPSharedGetLoggingDelegate(void) | ||
{ | ||
return wordPressSharedLogger; | ||
} | ||
|
||
void WPSharedSetLoggingLevel(DDLogLevel level) { | ||
ddLogLevel = level; | ||
void WPSharedSetLoggingDelegate(id<WordPressLoggingDelegate> _Nullable logger) | ||
{ | ||
wordPressSharedLogger = logger; | ||
} | ||
|
||
#define WPSharedLogv(logFunc) \ | ||
({ \ | ||
id<WordPressLoggingDelegate> logger = WPSharedGetLoggingDelegate(); \ | ||
if (logger == NULL) { \ | ||
NSLog(@"[WordPress-Shared] Warning: please call `WPSharedSetLoggingDelegate` to set a error logger."); \ | ||
return; \ | ||
} \ | ||
if (![logger respondsToSelector:@selector(logFunc)]) { \ | ||
NSLog(@"[WordPress-Shared] Warning: %@ does not implement " #logFunc, logger); \ | ||
return; \ | ||
} \ | ||
[logger performSelector:@selector(logFunc) withObject:[[NSString alloc] initWithFormat:str arguments:args]]; \ | ||
}) | ||
|
||
#define WPSharedLog(logFunc) \ | ||
({ \ | ||
va_list args; \ | ||
va_start(args, str); \ | ||
WPSharedLogv(logFunc); \ | ||
va_end(args); \ | ||
}) | ||
|
||
void WPSharedLogError(NSString *str, ...) { WPSharedLog(logError:); } | ||
void WPSharedLogWarning(NSString *str, ...) { WPSharedLog(logWarning:); } | ||
void WPSharedLogInfo(NSString *str, ...) { WPSharedLog(logInfo:); } | ||
void WPSharedLogDebug(NSString *str, ...) { WPSharedLog(logDebug:); } | ||
void WPSharedLogVerbose(NSString *str, ...) { WPSharedLog(logVerbose:); } | ||
|
||
void WPSharedLogvError(NSString *str, va_list args) { WPSharedLogv(logError:); } | ||
void WPSharedLogvWarning(NSString *str, va_list args) { WPSharedLogv(logWarning:); } | ||
void WPSharedLogvInfo(NSString *str, va_list args) { WPSharedLogv(logInfo:); } | ||
void WPSharedLogvDebug(NSString *str, va_list args) { WPSharedLogv(logDebug:); } | ||
void WPSharedLogvVerbose(NSString *str, va_list args) { WPSharedLogv(logVerbose:); } |
15 changes: 15 additions & 0 deletions
15
Sources/WordPressSharedObjC/Logging/WordPressLoggingDelegate.h
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,15 @@ | ||
#import <Foundation/Foundation.h> | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@protocol WordPressLoggingDelegate <NSObject> | ||
|
||
- (void)logError:(NSString *)str; | ||
- (void)logWarning:(NSString *)str; | ||
- (void)logInfo:(NSString *)str; | ||
- (void)logDebug:(NSString *)str; | ||
- (void)logVerbose:(NSString *)str; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 @@ | ||
../Logging/WordPressLoggingDelegate.h |
Oops, something went wrong.