Add method for handling OpenVPN log to the adapter delegate

This commit is contained in:
Sergey Abramchuk
2017-03-17 20:12:07 +03:00
parent ac4ec556c9
commit 42c692b225
2 changed files with 6 additions and 1 deletions

View File

@@ -34,6 +34,9 @@ NS_SWIFT_NAME(handle(event:message:));
- (void)handleError:(nonnull NSError *)error
NS_SWIFT_NAME(handle(error:));
- (void)handleLog:(nonnull NSString *)logMessage
NS_SWIFT_NAME(handle(logMessage:));
@end
@interface OpenVPNAdapter (Provider)

View File

@@ -248,8 +248,10 @@ static void socketCallback(CFSocketRef socket, CFSocketCallBackType type, CFData
}
- (void)handleLog:(const ClientAPI::LogInfo *)log {
NSAssert(self.delegate != nil, @"delegate property should not be nil");
NSString *message = [NSString stringWithCString:log->text.c_str() encoding:NSUTF8StringEncoding];
NSLog(@"%@", message);
[self.delegate handleLog:message];
}
- (OpenVPNEvent)getEventIdentifierByName:(NSString *)eventName {