[vlmc-devel] VlmcLogger: Allow VLC log level to be configured independently
Hugo Beauzée-Luyssen
git at videolan.org
Sun Feb 16 13:41:25 CET 2014
vlmc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Sun Feb 16 13:46:32 2014 +0200| [b525645faecb9049ddb4a3e206a118dfd166d24e] | committer: Hugo Beauzée-Luyssen
VlmcLogger: Allow VLC log level to be configured independently
> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=b525645faecb9049ddb4a3e206a118dfd166d24e
---
src/LibVLCpp/VLCInstance.cpp | 2 +-
src/Tools/VlmcLogger.cpp | 26 ++++++++++++++++++++++++++
2 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/src/LibVLCpp/VLCInstance.cpp b/src/LibVLCpp/VLCInstance.cpp
index e739849..86ccecb 100644
--- a/src/LibVLCpp/VLCInstance.cpp
+++ b/src/LibVLCpp/VLCInstance.cpp
@@ -41,7 +41,7 @@ Instance::Instance( QObject* parent /*= NULL*/ ) : QObject( parent )
// << "--no-overlay",
<< "--no-disable-screensaver"; //No need to disable the screensaver, and save a thread.
- int debugLevel = VLMC_GET_INT( "private/LogLevel" );
+ int debugLevel = VLMC_GET_INT( "private/VlcLogLevel" );
if ( debugLevel == VlmcLogger::Debug )
argv << "-vv";
else if ( debugLevel == VlmcLogger::Verbose )
diff --git a/src/Tools/VlmcLogger.cpp b/src/Tools/VlmcLogger.cpp
index 494a0ba..93d64e8 100644
--- a/src/Tools/VlmcLogger.cpp
+++ b/src/Tools/VlmcLogger.cpp
@@ -39,6 +39,11 @@ VlmcLogger::VlmcLogger() : m_logFile( NULL )
// Purposedly destroying the setting value, as we need to use the manager for other operations.
//FIXME: Actually I'm not sure for setting the value since this is a private variable.
}
+ {
+ SettingValue* logLevel = VLMC_CREATE_PREFERENCE( SettingValue::Int, "private/VlcLogLevel", (int)VlmcLogger::Quiet,
+ "", "", SettingValue::Private | SettingValue::Clamped | SettingValue::Runtime );
+ logLevel->setLimits((int)Debug, (int)Verbose);
+ }
QStringList args = qApp->arguments();
if ( args.indexOf( QRegExp( "-vv+" ) ) >= 0 )
m_currentLogLevel = VlmcLogger::Debug;
@@ -64,6 +69,27 @@ VlmcLogger::VlmcLogger() : m_logFile( NULL )
}
}
+ pos = args.indexOf( QRegExp( "--vlcverbose=.*" ) );
+ if ( pos > 0 )
+ {
+ QString arg = args[pos];
+ QString vlcLogLevelStr = arg.mid( 13 );
+
+ if ( vlcLogLevelStr.length() <= 0 )
+ vlmcWarning() << tr("Invalid value supplied for argument --vlcverbose" );
+ else
+ {
+ bool ok = false;
+ int vlcLogLevel = vlcLogLevelStr.toInt( &ok );
+ if (vlcLogLevel >= 2)
+ settingsManager->setValue( "private/VlcLogLevel", VlmcLogger::Debug, SettingsManager::Vlmc );
+ else if (vlcLogLevel == 1)
+ settingsManager->setValue( "private/VlcLogLevel", VlmcLogger::Verbose, SettingsManager::Vlmc );
+ else
+ vlmcWarning() << tr("Invalid value supplied for argument --vlcverbose" );
+ }
+ }
+
// QVariant setVal = SettingsManager::getInstance()->value( "private/LogFile", "log.vlmc", SettingsManager::Vlmc );
// SettingsManager::getInstance()->watchValue( "private/LogFile", this,
More information about the Vlmc-devel
mailing list