Improve logging in Module.cpp

This commit is contained in:
Teo Mrnjavac 2014-08-06 16:16:25 +02:00
parent be02eca90e
commit 014469c849

View File

@ -66,15 +66,14 @@ Module::fromDescriptorFile( const QString& path )
if ( descriptorFile.exists() && descriptorFile.open( QFile::ReadOnly | QFile::Text ) ) if ( descriptorFile.exists() && descriptorFile.open( QFile::ReadOnly | QFile::Text ) )
{ {
QByteArray ba = descriptorFile.readAll(); QByteArray ba = descriptorFile.readAll();
cDebug() << Q_FUNC_INFO << "module descriptor file" cDebug() << Q_FUNC_INFO << "module descriptor file" << path;
<< path << ":\n" << ba;
try try
{ {
YAML::Node doc = YAML::Load( ba.constData() ); YAML::Node doc = YAML::Load( ba.constData() );
if ( !doc.IsMap() ) if ( !doc.IsMap() )
{ {
cDebug() << Q_FUNC_INFO << "bad module descriptor format" cLog() << Q_FUNC_INFO << "bad module descriptor format"
<< path; << path;
return nullptr; return nullptr;
} }
@ -82,7 +81,7 @@ Module::fromDescriptorFile( const QString& path )
if ( !doc[ "type" ] || if ( !doc[ "type" ] ||
!doc[ "interface" ] ) !doc[ "interface" ] )
{ {
cDebug() << Q_FUNC_INFO << "bad module descriptor format" cLog() << Q_FUNC_INFO << "bad module descriptor format"
<< path; << path;
return nullptr; return nullptr;
} }
@ -110,7 +109,7 @@ Module::fromDescriptorFile( const QString& path )
if ( !m ) if ( !m )
{ {
cDebug() << Q_FUNC_INFO << "bad module type or interface string" cLog() << Q_FUNC_INFO << "bad module type or interface string"
<< path << typeString << intfString; << path << typeString << intfString;
return nullptr; return nullptr;
} }
@ -158,13 +157,13 @@ Module::loadConfigurationFile() //throws YAML::Exception
if ( configFile.exists() && configFile.open( QFile::ReadOnly | QFile::Text ) ) if ( configFile.exists() && configFile.open( QFile::ReadOnly | QFile::Text ) )
{ {
QByteArray ba = configFile.readAll(); QByteArray ba = configFile.readAll();
cDebug() << Q_FUNC_INFO << "module configuration file" cLog() << Q_FUNC_INFO << "module configuration file"
<< path << ":\n" << ba; << path << ":\n" << ba;
YAML::Node doc = YAML::Load( ba.constData() ); YAML::Node doc = YAML::Load( ba.constData() );
if ( !doc.IsMap() ) if ( !doc.IsMap() )
{ {
cDebug() << Q_FUNC_INFO << "bad module configuration format" cLog() << Q_FUNC_INFO << "bad module configuration format"
<< path; << path;
return; return;
} }