IOSAD-113 Using own logger.

IOSAD-113
Dirk Zimmermann 4 years ago
parent f9f5905b6a
commit 87a6afce12
  1. 27
      pEpObjCAdapter/PEPSync.m

@ -38,6 +38,8 @@ typedef int (* t_injectSyncCallback)(SYNC_EVENT ev, void *management);
@property (nonatomic, nullable) NSThread *syncThread;
@property (nonatomic, nullable) NSConditionLock *conditionLockForJoiningSyncThread;
+ (os_log_t)defaultLogger;
/**
@Return: The callback for message sending that should be used on every session init.
*/
@ -109,6 +111,8 @@ static SYNC_EVENT s_retrieve_next_sync_event(void *management, unsigned threshol
static __weak PEPSync *s_pEpSync;
static os_log_t s_logger;
// MARK: - Public PEPSync class
@implementation PEPSync
@ -196,11 +200,20 @@ static __weak PEPSync *s_pEpSync;
return s_pEpSync;
}
+ (os_log_t)defaultLogger
{
static dispatch_once_t once;
dispatch_once(&once, ^{
s_logger = os_log_create("security.pEp.adapter", "PEPSync");
});
return s_logger;
}
- (void)syncThreadLoop:(id)object
{
[self.conditionLockForJoiningSyncThread lock];
os_log(OS_LOG_DEFAULT, "trying to start the sync loop");
os_log([PEPSync defaultLogger], "trying to start the sync loop");
PEPInternalSession *session = [PEPSessionProvider session];
@ -210,19 +223,19 @@ static __weak PEPSync *s_pEpSync;
if (status == PEP_STATUS_OK) {
status = do_sync_protocol(session.session, nil);
if (status != PEP_STATUS_OK) {
os_log_error(OS_LOG_DEFAULT, "do_sync_protocol returned %d", status);
os_log(OS_LOG_DEFAULT, "sync loop is NOT running");
os_log_error([PEPSync defaultLogger], "do_sync_protocol returned %d", status);
os_log([PEPSync defaultLogger], "sync loop is NOT running");
}
unregister_sync_callbacks(session.session);
} else {
os_log_error(OS_LOG_DEFAULT, "register_sync_callbacks returned %d", status);
os_log(OS_LOG_DEFAULT, "sync loop is NOT running");
os_log_error([PEPSync defaultLogger], "register_sync_callbacks returned %d", status);
os_log([PEPSync defaultLogger], "sync loop is NOT running");
}
} else {
os_log_error(OS_LOG_DEFAULT, "could not create session for starting the sync loop");
os_log_error([PEPSync defaultLogger], "could not create session for starting the sync loop");
}
os_log(OS_LOG_DEFAULT, "sync loop finished");
os_log([PEPSync defaultLogger], "sync loop finished");
session = nil;

Loading…
Cancel
Save