summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--parameter/AutoLog.cpp25
-rw-r--r--parameter/AutoLog.h4
-rw-r--r--parameter/ParameterMgr.cpp22
-rw-r--r--parameter/XmlFileIncluderElement.cpp49
4 files changed, 56 insertions, 44 deletions
diff --git a/parameter/AutoLog.cpp b/parameter/AutoLog.cpp
index 629d57b..eb59b01 100644
--- a/parameter/AutoLog.cpp
+++ b/parameter/AutoLog.cpp
@@ -24,20 +24,23 @@
*/
#include "AutoLog.h"
-CAutoLog::CAutoLog(const CElement* pElement, const string& strContext) : _pElement(pElement), _strContext(strContext)
+CAutoLog::CAutoLog(const CElement* pElement, const string& strContext, bool bLogOn)
+ : _pElement(pElement), _strContext(strContext), _bLogOn(bLogOn)
{
- // Log
- _pElement->doLog(_strContext + " {");
-
- // Nest
- _pElement->nestLog();
+ if (_bLogOn) {
+ // Log
+ _pElement->doLog(_strContext + " {");
+ // Nest
+ _pElement->nestLog();
+ }
}
CAutoLog::~CAutoLog()
{
- // Unnest
- _pElement->unnestLog();
-
- // Log
- _pElement->doLog( "} " + _strContext);
+ if (_bLogOn) {
+ // Unnest
+ _pElement->unnestLog();
+ // Log
+ _pElement->doLog( "} " + _strContext);
+ }
}
diff --git a/parameter/AutoLog.h b/parameter/AutoLog.h
index c6a2a01..818b3c5 100644
--- a/parameter/AutoLog.h
+++ b/parameter/AutoLog.h
@@ -29,7 +29,7 @@
class CAutoLog
{
public:
- CAutoLog(const CElement* pElement, const string& strContext);
+ CAutoLog(const CElement* pElement, const string& strContext, bool bLogOn = true);
~CAutoLog();
private:
@@ -39,5 +39,7 @@ private:
const CElement* _pElement;
// Context
string _strContext;
+ // Log on
+ bool _bLogOn;
};
diff --git a/parameter/ParameterMgr.cpp b/parameter/ParameterMgr.cpp
index cff2b47..4e6e4da 100644
--- a/parameter/ParameterMgr.cpp
+++ b/parameter/ParameterMgr.cpp
@@ -332,19 +332,21 @@ bool CParameterMgr::load(string& strError)
// Back synchronization for areas in parameter blackboard not covered by any domain
CBackSynchronizer* pBackSynchronizer = createBackSynchronizer(strError);
- log("Main blackboard back synchronization");
-
// Back-synchronize
- if (!pBackSynchronizer->sync()) {
- // Get rid of back synchronizer
- delete pBackSynchronizer;
+ {
+ CAutoLog autoLog(this, "Main blackboard back synchronization");
- strError = "Main blackboard back synchronization failed: " + strError;
+ if (!pBackSynchronizer->sync()) {
+ // Get rid of back synchronizer
+ delete pBackSynchronizer;
- return false;
+ strError = "Main blackboard back synchronization failed: " + strError;
+
+ return false;
+ }
+ // Get rid of back synchronizer
+ delete pBackSynchronizer;
}
- // Get rif of back synchronizer
- delete pBackSynchronizer;
// We're done loading the settings and back synchronizing
CConfigurableDomains* pConfigurableDomains = getConfigurableDomains();
@@ -420,7 +422,7 @@ bool CParameterMgr::loadStructure(string& strError)
// Parse Structure XML file
CXmlParameterSerializingContext parameterBuildContext(strError);
- log("Importing system structure from file %s", strXmlStructureFilePath.c_str());
+ CAutoLog autolog(pSystemClass, "Importing system structure from file " + strXmlStructureFilePath);
if (!xmlParse(parameterBuildContext, pSystemClass, strXmlStructureFilePath, strXmlStructureFolder, EParameterCreationLibrary)) {
diff --git a/parameter/XmlFileIncluderElement.cpp b/parameter/XmlFileIncluderElement.cpp
index 4986758..06f64ff 100644
--- a/parameter/XmlFileIncluderElement.cpp
+++ b/parameter/XmlFileIncluderElement.cpp
@@ -27,6 +27,7 @@
#include "XmlMemoryDocSink.h"
#include "XmlElementSerializingContext.h"
#include "ElementLibrary.h"
+#include "AutoLog.h"
#include <assert.h>
#define base CKindElement
@@ -53,41 +54,45 @@ bool CXmlFileIncluderElement::fromXml(const CXmlElement& xmlElement, CXmlSeriali
// Instantiate parser
string strIncludedElementType = getIncludedElementType();
- // Use a doc source that load data from a file
- CXmlFileDocSource fileDocSource(strPath, elementSerializingContext.getXmlSchemaPathFolder() + "/" + strIncludedElementType + ".xsd", strIncludedElementType);
+ {
+ // Open a log section titled with loading file path
+ CAutoLog autolog(this, "Loading " + strPath);
- if (!fileDocSource.isParsable(elementSerializingContext)) {
+ // Use a doc source that load data from a file
+ CXmlFileDocSource fileDocSource(strPath, elementSerializingContext.getXmlSchemaPathFolder() + "/" + strIncludedElementType + ".xsd", strIncludedElementType);
- return false;
- }
+ if (!fileDocSource.isParsable(elementSerializingContext)) {
- // Get top level element
- CXmlElement childElement;
+ return false;
+ }
- fileDocSource.getRootElement(childElement);
+ // Get top level element
+ CXmlElement childElement;
- // Create child element
- CElement* pChild = elementSerializingContext.getElementLibrary()->createElement(childElement);
+ fileDocSource.getRootElement(childElement);
- if (pChild) {
+ // Create child element
+ CElement* pChild = elementSerializingContext.getElementLibrary()->createElement(childElement);
- // Store created child!
- getParent()->addChild(pChild);
- } else {
+ if (pChild) {
- elementSerializingContext.setError("Unable to create XML element " + childElement.getPath());
+ // Store created child!
+ getParent()->addChild(pChild);
+ } else {
- return false;
- }
+ elementSerializingContext.setError("Unable to create XML element " + childElement.getPath());
- // Use a doc sink that instantiate the structure from the doc source
- CXmlMemoryDocSink memorySink(pChild);
+ return false;
+ }
- if (!memorySink.process(fileDocSource, elementSerializingContext)) {
+ // Use a doc sink that instantiate the structure from the doc source
+ CXmlMemoryDocSink memorySink(pChild);
- return false;
- }
+ if (!memorySink.process(fileDocSource, elementSerializingContext)) {
+ return false;
+ }
+ }
// Detach from parent
getParent()->removeChild(this);