diff --git a/ecllibrary/std/system/Workunit.ecl b/ecllibrary/std/system/Workunit.ecl index b2fa8d57a93..e5583424581 100644 --- a/ecllibrary/std/system/Workunit.ecl +++ b/ecllibrary/std/system/Workunit.ecl @@ -12,6 +12,8 @@ EXPORT TimeStampRecord := lib_workunitservices.WsTimeStamp; EXPORT MessageRecord := lib_workunitservices.WsMessage; +EXPORT MessageRecord_v2 := lib_workunitservices.WsMessage_v2; + EXPORT FileReadRecord := lib_workunitservices.WsFileRead; EXPORT FileWrittenRecord := lib_workunitservices.WsFileWritten; @@ -126,7 +128,7 @@ EXPORT dataset(TimeStampRecord) WorkunitTimeStamps(varstring wuid) := * @param wuid the name of the workunit */ -EXPORT dataset(MessageRecord) WorkunitMessages(varstring wuid) := +EXPORT dataset(MessageRecord_v2) WorkunitMessages(varstring wuid) := lib_workunitservices.WorkUnitServices.WorkunitMessages(wuid); /* diff --git a/plugins/workunitservices/workunitservices.cpp b/plugins/workunitservices/workunitservices.cpp index 6411b6d6d15..c62c86bd347 100644 --- a/plugins/workunitservices/workunitservices.cpp +++ b/plugins/workunitservices/workunitservices.cpp @@ -90,7 +90,19 @@ static const char * EclDefinition = " unsigned4 col;" " string16 source;" " string20 time;" - " string message{maxlength(1024)};" + " string message{maxlength(1024)};" + " end;\n" +"export WsMessage_v2 := record " + " unsigned4 severity;" + " integer4 code;" + " string32 location;" + " unsigned4 row;" + " unsigned4 col;" + " string16 source;" + " string20 time;" + " unsigned4 priority;" + " real8 cost;" + " string message{maxlength(1024)};" " end;\n" "export WsFileRead := record " " string name{maxlength(256)};" @@ -143,7 +155,7 @@ static const char * EclDefinition = " varstring WUIDonDate(unsigned4 year,unsigned4 month,unsigned4 day,unsigned4 hour, unsigned4 minute) : entrypoint='wsWUIDonDate'; \n" " varstring WUIDdaysAgo(unsigned4 daysago) : entrypoint='wsWUIDdaysAgo'; \n" " dataset(WsTimeStamp) WorkunitTimeStamps(const varstring wuid) : context,entrypoint='wsWorkunitTimeStamps'; \n" -" dataset(WsMessage) WorkunitMessages(const varstring wuid) : context,entrypoint='wsWorkunitMessages'; \n" +" dataset(WsMessage_v2) WorkunitMessages(const varstring wuid) : context,entrypoint='wsWorkunitMessages_v2'; \n" " dataset(WsFileRead) WorkunitFilesRead(const varstring wuid) : context,entrypoint='wsWorkunitFilesRead'; \n" " dataset(WsFileWritten) WorkunitFilesWritten(const varstring wuid) : context,entrypoint='wsWorkunitFilesWritten'; \n" " dataset(WsTiming) WorkunitTimings(const varstring wuid) : context,entrypoint='wsWorkunitTimings'; \n" @@ -578,7 +590,7 @@ WORKUNITSERVICES_API void wsWorkunitTimeStamps(ICodeContext *ctx, size32_t & __l __result = mb.detach(); } -WORKUNITSERVICES_API void wsWorkunitMessages( ICodeContext *ctx, size32_t & __lenResult, void * & __result, const char *wuid ) +void wsWorkunitMessagesImpl( ICodeContext *ctx, size32_t & __lenResult, void * & __result, const char *wuid, bool returnCosts) { Owned wu = getWorkunit(ctx, wuid); MemoryBuffer mb; @@ -599,6 +611,11 @@ WORKUNITSERVICES_API void wsWorkunitMessages( ICodeContext *ctx, size32_t & __le fixedAppend(mb, 16, s.str(), s.length()); e.getTimeStamp(s); fixedAppend(mb, 20, s.str(), s.length()); + if (returnCosts) + { + mb.append((unsigned) e.getPriority()); + mb.append((double) e.getCost()); + } e.getExceptionMessage(s); varAppendMax(mb, 1024, s.str(), s.length()); } @@ -607,6 +624,17 @@ WORKUNITSERVICES_API void wsWorkunitMessages( ICodeContext *ctx, size32_t & __le __result = mb.detach(); } + +WORKUNITSERVICES_API void wsWorkunitMessages( ICodeContext *ctx, size32_t & __lenResult, void * & __result, const char *wuid) +{ + wsWorkunitMessagesImpl(ctx, __lenResult, __result, wuid, false); +} + +WORKUNITSERVICES_API void wsWorkunitMessages_v2( ICodeContext *ctx, size32_t & __lenResult, void * & __result, const char *wuid) +{ + wsWorkunitMessagesImpl(ctx, __lenResult, __result, wuid, true); +} + WORKUNITSERVICES_API void wsWorkunitFilesRead( ICodeContext *ctx, size32_t & __lenResult, void * & __result, const char *wuid ) { MemoryBuffer mb; diff --git a/plugins/workunitservices/workunitservices.hpp b/plugins/workunitservices/workunitservices.hpp index c9b8eba8607..94526f729ca 100644 --- a/plugins/workunitservices/workunitservices.hpp +++ b/plugins/workunitservices/workunitservices.hpp @@ -66,7 +66,8 @@ WORKUNITSERVICES_API void WORKUNITSERVICES_CALL wsWorkunitList( ICodeContext *ct WORKUNITSERVICES_API char * wsWUIDonDate(unsigned year,unsigned month,unsigned day,unsigned hour,unsigned minute); WORKUNITSERVICES_API char * wsWUIDdaysAgo(unsigned daysago); WORKUNITSERVICES_API void WORKUNITSERVICES_CALL wsWorkunitTimeStamps( ICodeContext *ctx, size32_t & __lenResult, void * & __result, const char *wuid ); -WORKUNITSERVICES_API void WORKUNITSERVICES_CALL wsWorkunitMessages( ICodeContext *ctx, size32_t & __lenResult, void * & __result, const char *wuid ); +WORKUNITSERVICES_API void WORKUNITSERVICES_CALL wsWorkunitMessages( ICodeContext *ctx, size32_t & __lenResult, void * & __result, const char *wuid); +WORKUNITSERVICES_API void WORKUNITSERVICES_CALL wsWorkunitMessages_v2( ICodeContext *ctx, size32_t & __lenResult, void * & __result, const char *wuid); WORKUNITSERVICES_API void WORKUNITSERVICES_CALL wsWorkunitFilesRead( ICodeContext *ctx, size32_t & __lenResult, void * & __result, const char *wuid ); WORKUNITSERVICES_API void WORKUNITSERVICES_CALL wsWorkunitFilesWritten( ICodeContext *ctx, size32_t & __lenResult, void * & __result, const char *wuid ); WORKUNITSERVICES_API void WORKUNITSERVICES_CALL wsWorkunitTimings( ICodeContext *ctx, size32_t & __lenResult, void * & __result, const char *wuid );