Commit fdc3e809 authored by Felix Paul Kühne's avatar Felix Paul Kühne Committed by Caro

VLCLibrary: add API to log debug info to a file

parent b087ec9d
......@@ -2,10 +2,11 @@
* VLCLibrary.h: VLCKit.framework VLCLibrary header
*****************************************************************************
* Copyright (C) 2007 Pierre d'Herbemont
* Copyright (C) 2007 VLC authors and VideoLAN
* Copyright (C) 2007-2019 VLC authors and VideoLAN
* $Id$
*
* Authors: Pierre d'Herbemont <pdherbemont # videolan.org>
* Felix Paul Kühne <fkuehne # videolan.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
......@@ -57,10 +58,20 @@
/**
* Gets/sets the debug logging level
* \note Logging level ranges from 0 (just error messages) to 4 (everything)
* \note values set here will be ignored when logging to a file
* \warning If an invalid level is provided, level defaults to 0
*/
@property (readwrite, nonatomic) int debugLoggingLevel;
/**
* Activates debug logging to a file stream
* If the file already exists, the log will be appended by the end. If it does not exist, will be created.
* The file will continously updated with new messages from this library instance.
* \note It is the client app's obligation to ensure that the target file path is writable and all subfolders exist
* \warning when enabling this feature, logging to the console will be stopped automatically
*/
- (void)setDebugLoggingToFile:(NSString * _Nonnull)filePath;
/**
* Returns the library's version
* \return The library version example "0.9.0-git Grishenko"
......
......@@ -3,6 +3,10 @@ Version 4.0.0:
- Rename buildMobileVLCKit to compileAndBuildVLCKit
- Use NSDateComponents API for VLCTime.verboseStringValue
Version 3.2.1:
--------------
- Add API to VLCLibrary to log debug information to a file
Version 3.2.0:
--------------
- Enabled libmux module
......@@ -27,9 +31,6 @@ VLCTranscoderDelegate:
VLCTranscoder:
- (BOOL)reencodeAndMuxSRTFile:(NSString *)srtPath toMP4File:(NSString *)mp4Path outputPath:(NSString *)outPath
Version 3.1.5:
--------------
- Fixed a crash when updateProgressCallback was called
......
......@@ -2,10 +2,11 @@
* VLCLibrary.m: VLCKit.framework VLCLibrary implementation
*****************************************************************************
* Copyright (C) 2007 Pierre d'Herbemont
* Copyright (C) 2007 VLC authors and VideoLAN
* Copyright (C) 2007-2019 VLC authors and VideoLAN
* $Id$
*
* Authors: Pierre d'Herbemont <pdherbemont # videolan.org>
* Felix Paul Kühne <fkuehne # videolan.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
......@@ -42,6 +43,12 @@ static void HandleMessage(void *,
static VLCLibrary * sharedLibrary = nil;
@interface VLCLibrary()
{
FILE *_logFileStream;
}
@end
@implementation VLCLibrary
+ (VLCLibrary *)sharedLibrary
......@@ -144,6 +151,9 @@ static VLCLibrary * sharedLibrary = nil;
libvlc_log_set(_instance, HandleMessage, (__bridge void *)(self));
} else {
libvlc_log_unset(_instance);
if (_logFileStream)
fclose(_logFileStream);
}
}
......@@ -159,6 +169,25 @@ static VLCLibrary * sharedLibrary = nil;
}
}
- (void)setDebugLoggingToFile:(NSString * _Nonnull)filePath
{
if (!filePath)
return;
if (!_instance)
return;
if (_debugLogging) {
libvlc_log_unset(_instance);
}
_logFileStream = fopen([filePath UTF8String], "a");
if (_logFileStream) {
libvlc_log_set_file(_instance, _logFileStream);
}
}
- (NSString *)version
{
return @(libvlc_get_version());
......@@ -188,8 +217,14 @@ static VLCLibrary * sharedLibrary = nil;
- (void)dealloc
{
if (_instance)
if (_instance) {
libvlc_log_unset(_instance);
libvlc_release(_instance);
}
if (_logFileStream) {
fclose(_logFileStream);
}
}
@end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment