[vlmc-devel] commit: VLC debug level can now be set through the command line. ( Hugo Beauzée-Luyssen )

Rohit Yadav rohityadav89 at gmail.com
Mon Oct 11 19:38:29 CEST 2010


Hello Hugo and everyone,

I have update the man page and help string in
http://git.videolan.org/?p=vlmc.git;a=commit;h=a1252b597b2cd3628e61d11abc818fde50eb85cb
Do you want to introduce a cmd line options like:
vlmc --verbose <level>
or, vlmc -v <level>
or like,
vlmc --debug <level>
vlmc -d <level>
or, vlmc --logfile etc etc... Ideas?

How about introducing a debugging API to be used throughout VLMC instead of
qDebug() with colours logging info (time, address etc. as in VLC)
Perhaps we can modify and use VlmcDebug... and use it just like qDebug() <<
...

Also, an option to log outputs etc. to a file... giving explicit path in
VLMC preferences (so perhaps user can decide...),
uncomment and work on some code in VlmcDebug.

Best Regards,
Rohit Yadav

On Mon, Oct 11, 2010 at 4:40 AM, <git at videolan.org> wrote:

> vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Mon
> Oct 11 01:09:34 2010 +0200| [f4d792068750583b777049bacf230b5142b28ee2] |
> committer: Hugo Beauzée-Luyssen
>
> VLC debug level can now be set through the command line.
>
> This will ease the pain when asking a user to enable vlc's log...
>
> >
> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=f4d792068750583b777049bacf230b5142b28ee2
> ---
>
>  src/Gui/MainWindow.cpp         |    2 +-
>  src/LibVLCpp/VLCInstance.cpp   |   12 +++++++++++-
>  src/Settings/SettingsManager.h |    2 ++
>  src/Tools/VlmcDebug.cpp        |   29 +++++++++++++++--------------
>  src/Tools/VlmcDebug.h          |    7 +++++++
>  5 files changed, 36 insertions(+), 16 deletions(-)
>
> diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp
> index 96e057d..eaf40f1 100644
> --- a/src/Gui/MainWindow.cpp
> +++ b/src/Gui/MainWindow.cpp
> @@ -73,7 +73,7 @@ MainWindow::MainWindow( QWidget *parent ) :
>     m_ui.setupUi( this );
>
>     //We only install message handler here cause it uses configuration.
> -//    VlmcDebug::getInstance()->setup();
> +    VlmcDebug::getInstance()->setup();
>
>     //VLC Instance:
>     LibVLCpp::Instance::getInstance();
> diff --git a/src/LibVLCpp/VLCInstance.cpp b/src/LibVLCpp/VLCInstance.cpp
> index 96717e5..61a64d9 100644
> --- a/src/LibVLCpp/VLCInstance.cpp
> +++ b/src/LibVLCpp/VLCInstance.cpp
> @@ -23,13 +23,16 @@
>  #include "VLCInstance.h"
>  #include "vlc/vlc.h"
>
> +#include "SettingsManager.h"
> +#include "VlmcDebug.h"
> +
>  using namespace LibVLCpp;
>
>  Instance::Instance( QObject* parent /*= NULL*/ ) : QObject( parent )
>  {
>     char const *argv[] =
>     {
> -//        "-vvvvv",
> +        "", //Keep this array entry empty. It will be replaced later if
> required.
>  //        "--ffmpeg-debug", "3",
>         "--no-skip-frames",
>  //        "--intf", "dummy",
> @@ -42,6 +45,13 @@ Instance::Instance( QObject* parent /*= NULL*/ ) :
> QObject( parent )
>     };
>     int argc = sizeof( argv ) / sizeof( *argv );
>
> +    int     debugLevel = VLMC_GET_INT( "private/LogLevel" );
> +    qDebug() << debugLevel;
> +    if ( debugLevel == VlmcDebug::Debug )
> +        argv[0] = "-vv";
> +    else if ( debugLevel == VlmcDebug::Verbose )
> +        argv[0] = "-v";
> +
>     m_internalPtr = libvlc_new( argc, argv );
>     Q_ASSERT_X( m_internalPtr != NULL, "LibVLCpp::Instance::Instance()",
>                 "Can't launch VLMC without a valid LibVLC instance. Please
> check your VLC installation" );
> diff --git a/src/Settings/SettingsManager.h
> b/src/Settings/SettingsManager.h
> index 3bbf1ee..65975ee 100644
> --- a/src/Settings/SettingsManager.h
> +++ b/src/Settings/SettingsManager.h
> @@ -90,6 +90,8 @@ SettingsManager::getInstance()->createVar( type, key,
> defaultValue, name,  \
>  //Convenience maccros :
>  #define VLMC_CREATE_PRIVATE_PREFERENCE_STRING( key, defaultValue )  \
>         VLMC_CREATE_PREFERENCE( SettingValue::String, key, defaultValue,
> "", "", SettingValue::Private )
> +#define VLMC_CREATE_PRIVATE_PREFERENCE_INT( key, defaultValue )  \
> +        VLMC_CREATE_PREFERENCE( SettingValue::Int, key, defaultValue, "",
> "", SettingValue::Private )
>  #define VLMC_CREATE_PRIVATE_PROJECT_STRING( key, defaultValue )  \
>         VLMC_CREATE_PROJECT_VAR( SettingValue::String, key, defaultValue,
> "", "", SettingValue::Private )
>  #define VLMC_CREATE_PREFERENCE_PASSWORD( key, defaultValue, name, desc )
>  \
> diff --git a/src/Tools/VlmcDebug.cpp b/src/Tools/VlmcDebug.cpp
> index 9bbbe9d..6adb3ec 100644
> --- a/src/Tools/VlmcDebug.cpp
> +++ b/src/Tools/VlmcDebug.cpp
> @@ -29,24 +29,25 @@
>  VlmcDebug::VlmcDebug() : m_logFile( NULL )
>  {
>     //setup log level :
> +    VLMC_CREATE_PRIVATE_PREFERENCE_INT( "private/LogLevel", 0 );
>     QStringList args = qApp->arguments();
> -    if ( args.indexOf( QRegExp( "-vvv*" ) ) >= 0 )
> -        SettingsManager::getInstance()->setValue( "private/LogLevel",
> QtDebugMsg, SettingsManager::Vlmc );
> +    if ( args.indexOf( QRegExp( "-vv+" ) ) >= 0 )
> +        SettingsManager::getInstance()->setValue( "private/LogLevel",
> VlmcDebug::Debug, SettingsManager::Vlmc );
>     else if ( args.contains( "-v" ) == true )
> -        SettingsManager::getInstance()->setValue( "private/LogLevel",
> QtWarningMsg, SettingsManager::Vlmc );
> +        SettingsManager::getInstance()->setValue( "private/LogLevel",
> VlmcDebug::Verbose, SettingsManager::Vlmc );
>     else
> -        SettingsManager::getInstance()->setValue( "private/LogLevel",
> QtCriticalMsg, SettingsManager::Vlmc );
> +        SettingsManager::getInstance()->setValue( "private/LogLevel",
> VlmcDebug::Quiet, SettingsManager::Vlmc );
>
> -    int pos = args.indexOf( QRegExp( "--logfile=.*" ) );
> -    if ( pos > 0 )
> -    {
> -        QString arg = args[pos];
> -        QString logFile = arg.mid( 10 );
> -        if ( logFile.length() <= 0 )
> -            qWarning() << tr("Invalid value supplied for argument
> --logfile" );
> -        else
> -            SettingsManager::getInstance()->setValue( "private/LogFile",
> logFile, SettingsManager::Vlmc );
> -    }
> +//    int pos = args.indexOf( QRegExp( "--logfile=.*" ) );
> +//    if ( pos > 0 )
> +//    {
> +//        QString arg = args[pos];
> +//        QString logFile = arg.mid( 10 );
> +//        if ( logFile.length() <= 0 )
> +//            qWarning() << tr("Invalid value supplied for argument
> --logfile" );
> +//        else
> +//            SettingsManager::getInstance()->setValue( "private/LogFile",
> logFile, SettingsManager::Vlmc );
> +//    }
>
>
>  //    QVariant setVal = SettingsManager::getInstance()->value(
> "private/LogFile", "log.vlmc", SettingsManager::Vlmc );
> diff --git a/src/Tools/VlmcDebug.h b/src/Tools/VlmcDebug.h
> index 2f4eee7..85ba9c5 100644
> --- a/src/Tools/VlmcDebug.h
> +++ b/src/Tools/VlmcDebug.h
> @@ -38,6 +38,13 @@ class   VlmcDebug : public QObject, public
> Singleton<VlmcDebug>
>     Q_OBJECT
>
>     public:
> +        enum    VerboseLevel
> +        {
> +            Quiet,
> +            Verbose,
> +            Debug
> +        };
> +
>         static void     vlmcMessageHandler( QtMsgType type, const char* msg
> );
>         void            setup();
>     private:
>
> _______________________________________________
> Vlmc-devel mailing list
> Vlmc-devel at videolan.org
> http://mailman.videolan.org/listinfo/vlmc-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlmc-devel/attachments/20101011/b23ddd85/attachment-0001.htm>


More information about the Vlmc-devel mailing list