Commit 11a986d1 authored by Patrick Ohly's avatar Patrick Ohly
Browse files

engine logging: new API with more information provided to the engine

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.
parent 049cfe8c
......@@ -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
......@@ -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
......
......@@ -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
......
......@@ -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);
......
......@@ -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,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment