mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-30 05:28:50 +00:00
Sparkle: Add backwards compatibility with 10.11 SDK for logging
10.11 SDK does not contain the os_log API yet. Code is modified in such a way that it compiles with older SDKs, and falls back to the old implementation even if it runs on 10.12.
This commit is contained in:
1 parent
558cfd2153
commit
a7ba0bea6e
1 file changed
+18
-1
Vendored
+18
-1
@@ -7,15 +7,29 @@
|
||||
//
|
||||
|
||||
#include "SULog.h"
|
||||
|
||||
#include <asl.h>
|
||||
#include <Availability.h>
|
||||
|
||||
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101200
|
||||
#include <os/log.h>
|
||||
#else
|
||||
|
||||
typedef struct os_log_s *os_log_t;
|
||||
#define os_log_create(subsystem, category) nil
|
||||
|
||||
#define os_log(log, format, ...)
|
||||
#define os_log_error(log, format, ...)
|
||||
|
||||
#endif
|
||||
|
||||
#include "AppKitPrevention.h"
|
||||
#import "SUOperatingSystem.h"
|
||||
|
||||
// For converting constants to string literals using the preprocessor
|
||||
#define STRINGIFY(x) #x
|
||||
#define TO_STRING(x) STRINGIFY(x)
|
||||
|
||||
#include "AppKitPrevention.h"
|
||||
|
||||
void SULog(SULogLevel level, NSString *format, ...)
|
||||
{
|
||||
@@ -30,6 +44,9 @@ void SULog(SULogLevel level, NSString *format, ...)
|
||||
NSBundle *mainBundle = [NSBundle mainBundle];
|
||||
|
||||
hasOSLogging = [SUOperatingSystem isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion){10, 12, 0}];
|
||||
#if __MAC_OS_X_VERSION_MAX_ALLOWED < 101200
|
||||
hasOSLogging = NO;
|
||||
#endif
|
||||
|
||||
if (hasOSLogging) {
|
||||
const char *subsystem = SPARKLE_BUNDLE_IDENTIFIER;
|
||||
|
||||
Reference in new issue
Block a user