diff options
author | Damiano Galassi <[email protected]> | 2015-10-20 18:24:57 +0200 |
---|---|---|
committer | Damiano Galassi <[email protected]> | 2015-10-20 18:24:57 +0200 |
commit | c32d5236135c6be0b4987fb74de511e3332d7396 (patch) | |
tree | b9b8d32cb1782a5f0eb587af07fc8b5586b0a1f2 /macosx | |
parent | ba3d0e46199db21c1e4e899cc1d852ed0738d951 (diff) |
MacGui: expose a property to set the log level in HBCore.
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/HBCore.h | 5 | ||||
-rw-r--r-- | macosx/HBCore.m | 8 |
2 files changed, 13 insertions, 0 deletions
diff --git a/macosx/HBCore.h b/macosx/HBCore.h index 36335114e..dafda29ad 100644 --- a/macosx/HBCore.h +++ b/macosx/HBCore.h @@ -85,6 +85,11 @@ typedef void (^HBCoreCompletionHandler)(HBCoreResult result); - (instancetype)initWithLogLevel:(int)level name:(NSString *)name; /** + * Log level. + */ +@property (nonatomic, readwrite) int logLevel; + +/** * Current state of HBCore. */ @property (nonatomic, readonly) HBState state; diff --git a/macosx/HBCore.m b/macosx/HBCore.m index c6925abbf..88bc5e9c2 100644 --- a/macosx/HBCore.m +++ b/macosx/HBCore.m @@ -97,6 +97,7 @@ static void hb_error_handler(const char *errmsg) _state = HBStateIdle; _updateTimerQueue = dispatch_queue_create("fr.handbrake.coreQueue", DISPATCH_QUEUE_SERIAL); _hb_state = malloc(sizeof(struct hb_state_s)); + _logLevel = level; _hb_handle = hb_init(level, 0); if (!_hb_handle) @@ -132,10 +133,17 @@ static void hb_error_handler(const char *errmsg) free(_hb_state); } +- (void)setLogLevel:(int)logLevel +{ + _logLevel = logLevel; + hb_log_level_set(_hb_handle, logLevel); +} + #pragma mark - Scan - (BOOL)canScan:(NSURL *)url error:(NSError * __autoreleasing *)error { + NSAssert(url, @"[HBCore canScan:] called with nil url."); if (![[NSFileManager defaultManager] fileExistsAtPath:url.path]) { if (error) { *error = [NSError errorWithDomain:@"HBErrorDomain" |