Explorar o código

VLCLibrary: Update and check debug logging status (closes #186)

Mike JS. Choi %!s(int64=7) %!d(string=hai) anos
pai
achega
7010d0c507
Modificáronse 1 ficheiros con 15 adicións e 1 borrados
  1. 15 1
      Sources/VLCLibrary.m

+ 15 - 1
Sources/VLCLibrary.m

@@ -71,7 +71,7 @@ static VLCLibrary * sharedLibrary = nil;
     return self;
 }
 
-- (instancetype)initWithOptions:(NSArray*)options
+- (instancetype)initWithOptions:(NSArray *)options
 {
     if (self = [super init]) {
         [self prepareInstanceWithOptions:options];
@@ -143,6 +143,8 @@ static VLCLibrary * sharedLibrary = nil;
     if (!_instance)
         return;
 
+    _debugLogging = debugLogging;
+    
     if (debugLogging) {
         libvlc_log_set(_instance, HandleMessage, (__bridge void *)(self));
     } else {
@@ -150,6 +152,18 @@ static VLCLibrary * sharedLibrary = nil;
     }
 }
 
+- (void)setDebugLoggingLevel:(int)debugLoggingLevel
+{
+    if (debugLoggingLevel >= 0 && debugLoggingLevel <= 4) {
+        _debugLoggingLevel = debugLoggingLevel;
+    } else {
+        VKLog(@"Invalid debugLoggingLevel of %d provided", debugLoggingLevel);
+        VKLog(@"Please provide a valid debugLoggingLevel between 0 and 4");
+        VKLog(@"Defaulting debugLoggingLevel to 0 (just errors)");
+        _debugLoggingLevel = 0;
+    }
+}
+
 - (NSString *)version
 {
     return @(libvlc_get_version());