summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Ohly <patrick.ohly@intel.com>2009-07-03 12:05:21 +0200
committerPatrick Ohly <patrick.ohly@intel.com>2009-07-03 12:05:21 +0200
commit11a986d1653e6b00952064d91310e75eac461b50 (patch)
treefa09e7f669f1555fac9a49f91c9b0db1313bfb66
parent049cfe8c7febb070a92c97b8f6f9a4dea51bd8eb (diff)
engine logging: new API with more information provided to the enginelogging_upstream
The SySyncDebugPuts() call is tentative and not supported by the TEngineBridge. It has to be called directly. Not all of the information is currently used. To change that, TClientEngineInterface::debugPuts() must pass them to an enhanced TDebugLogger implementation. The main purpose right now is that SyncEvolution has different log levels, which cannot be properly represented in the Synthesis log without the possibility to specify flags.
-rwxr-xr-xsrc/sysync/engineentry.cpp9
-rwxr-xr-xsrc/sysync/syncclientbase.cpp13
-rw-r--r--src/sysync/syncclientbase.h4
-rwxr-xr-xsrc/sysync_SDK/Sources/enginemodulebase.h27
-rwxr-xr-xsrc/sysync_SDK/Sources/sync_dbapidef.h7
5 files changed, 59 insertions, 1 deletions
diff --git a/src/sysync/engineentry.cpp b/src/sysync/engineentry.cpp
index 4991dd4..fbf1629 100755
--- a/src/sysync/engineentry.cpp
+++ b/src/sysync/engineentry.cpp
@@ -329,6 +329,15 @@ void CB_Connect( void* aCB )
} // CB_Connect
+void SySyncDebugPuts(void* aCB,
+ cAppCharP aFile, int aLine, cAppCharP aFunction,
+ int aDbgLevel, cAppCharP aLinePrefix,
+ cAppCharP aText)
+{
+ URef( aCB )->debugPuts(aFile, aLine, aFunction,
+ aDbgLevel, aLinePrefix, aText);
+}
+
} // namespace sysync
// eof
diff --git a/src/sysync/syncclientbase.cpp b/src/sysync/syncclientbase.cpp
index b1e3a6c..d300e07 100755
--- a/src/sysync/syncclientbase.cpp
+++ b/src/sysync/syncclientbase.cpp
@@ -306,6 +306,19 @@ InstanceID_t TClientEngineInterface::getSmlInstanceOfSession(SessionH aSessionH)
return clientSessionP->getSmlWorkspaceID();
} // TClientEngineInterface::getSmlInstanceOfSession
+TSyError TClientEngineInterface::debugPuts(cAppCharP aFile, int aLine, cAppCharP aFunction,
+ int aDbgLevel, cAppCharP aPrefix,
+ cAppCharP aText)
+{
+ #if defined(SYDEBUG)
+ static_cast<TSyncClientBase *>(getSyncAppBase())->getDbgLogger()->DebugPuts(/* aFile, aLine, aFunction, aPrefix */
+ aDbgLevel, aText);
+ return 0;
+ #else
+ return LOCERR_NOTIMP;
+ #endif
+}
+
#endif // ENGINE_LIBRARY
#endif // ENGINEINTERFACE_SUPPORT
diff --git a/src/sysync/syncclientbase.h b/src/sysync/syncclientbase.h
index 3685f30..52af01f 100644
--- a/src/sysync/syncclientbase.h
+++ b/src/sysync/syncclientbase.h
@@ -85,6 +85,10 @@ public:
/// @return LOCERR_OK on success, SyncML or LOCERR_xxx error code on failure
virtual TSyError SessionStep(SessionH aSessionH, uInt16 &aStepCmd, TEngineProgressInfo *aInfoP = NULL);
+ virtual TSyError debugPuts(cAppCharP aFile, int aLine, cAppCharP aFunction,
+ int aDbgLevel, cAppCharP aLinePrefix,
+ cAppCharP aText);
+
protected:
/// @brief returns the SML instance for a given session handle
diff --git a/src/sysync_SDK/Sources/enginemodulebase.h b/src/sysync_SDK/Sources/enginemodulebase.h
index 2865e7b..3335a0f 100755
--- a/src/sysync_SDK/Sources/enginemodulebase.h
+++ b/src/sysync_SDK/Sources/enginemodulebase.h
@@ -366,8 +366,35 @@ class TEngineModuleBase
virtual TSyError InsertItemAsKey ( CContext ac, KeyH aItemKey, cItemID aID )= 0;
virtual TSyError UpdateItemAsKey ( CContext ac, KeyH aItemKey, cItemID aID,
ItemID updID )= 0;
+ virtual TSyError debugPuts(cAppCharP aFile, int aLine, cAppCharP aFunction,
+ int aDbgLevel, cAppCharP aLinePrefix,
+ cAppCharP aText) { return LOCERR_NOTIMP; }
}; // TEngineModuleBase
+// debug level masks (original definition in sysync_debug.h)
+#define DBG_HOT 0x00000001 // hot information
+#define DBG_ERROR 0x00000002 // Error conditions
+
+/**
+ * @param aFile source file name from which log entry comes
+ * @param aLine source file line
+ * @param aFunction function name
+ * @param aDbgLevel same bit mask as in the internal TDebugLogger;
+ * currently DBG_HOT and DBG_ERROR are defined publicly
+ * @param aLinePrefix a short string to be displayed in front of each line;
+ * the advantage of passing this separately instead of
+ * making it a part of aText is that the logger might
+ * be able to insert the prefix more efficiently and/or
+ * (depending on the log format) with extra formatting
+ * @param aText the text to be printed, may consist of multiple lines;
+ * the log always starts a new line after the text, regardless
+ * of how many newlines might be at the end of the text
+ */
+void SySyncDebugPuts(void* aCB,
+ cAppCharP aFile, int aLine, cAppCharP aFunction,
+ int aDbgLevel, cAppCharP aLinePrefix,
+ cAppCharP aText);
+
// factory function declaration - must be implemented in the source file of the leaf derivate of TEngineInterface
TEngineModuleBase *newEngine(void);
diff --git a/src/sysync_SDK/Sources/sync_dbapidef.h b/src/sysync_SDK/Sources/sync_dbapidef.h
index 9ed9a95..252478e 100755
--- a/src/sysync_SDK/Sources/sync_dbapidef.h
+++ b/src/sysync_SDK/Sources/sync_dbapidef.h
@@ -359,7 +359,12 @@ struct TunnelWrapper {
* The same structure contains all call-in functions for the UI Api.
*/
-/* <debugFlags>: Reserved plugin specific bit masks */
+/**
+ * <debugFlags>: Reserved plugin specific bit masks.
+ * These flags are only used by the SDK_util logging helper functions.
+ * They are *not* passed into the Synthesis engine and thus cannot
+ * control how the logged text is stored in the log file.
+ */
enum DebugFlags {
/** No debugging */
DBG_PLUGIN_NONE = 0x0000,