icMessage | input | character | Message-string that needs to be written to the log-file. Tis message is written first, before optionaly the ProgressErrorMessages or the tFcMessages are written to the log-file too. |
icProgressErrorMessage | input | character | Fill this parameter in case you want to extend the message in the log-file with a proper Progress error. This should only be the case when a Progress-error occured: You can pass in this as value for this parameter: error-status:get-message(1) Note: if there is no progress-error then error-status:get-message(1) will just return an empty string so this can be passed in all cases |
ilIncludetFcMessages | input | logical | IncludetFcMessages: Set to true in case you want to write the tFcMessages into the log-file. If this param is set to true and no valid-handle is passed for param ''ihInstanceHandle" then we will just write the local tFcMessages to the log-file.. If this param is set to true and a valid-handle is passed for param ''ihInstanceHandle" then we will try to get the tFcMessages from the program in that instance and write these to the log-file. |
oiReturnStatus | output | integer | Return status of the method. |
/* Append to the file */ output to value(vcLogFileName) append. /* Write the input msg to the file */ put unformatted string(now) + ": ":U + trim(icMessage) skip. /* Close the file */ output close. /* Actions to write the progress-errors covered */ assign icProgressErrorMessage = trim(icProgressErrorMessage). if icProgressErrorMessage <> "":U and icProgressErrorMessage <> ? then do : output to value(vcLogFileName) append. put unformatted " ** ":U "Progress-error: " icProgressErrorMessage skip. output close. end. /* if icProgressErrorMessage <> "":U and */ /* Actions on the tFcMessages */ if ilIncludetFcMessages = true and can-find (first tFcMessages) then do : /* Write the messages to the log-file */ output to value(vcLogFileName) append. for each tFcMessages on error undo, throw : put unformatted " ** ":U "tFcMessages: ":U + replace(tFcMessages.tcFcMessage,chr(10),". ":U) + " (" + string(tFcMessages.tcFcMsgNumber) + ")":U . if tFcMessages.tcfcfieldname <> "":U and tFcMessages.tcfcfieldname <> ? then put unformatted " - Field: ":U + tFcMessages.tcFcFieldLabel + "(":U + tFcMessages.tcFcFieldName + ") = ":U + tFcMessages.tcFcFieldValue. put unformatted skip. end. /* for each tFcMessages */ output close. /* Empty the messages-table so we only dump a single message once */ empty temp-table tFcMessages. end. /* if ilIncludetFcMessages = true and */ /* Simple assignment to ensure eror-status:error and error-status:get-message(1) are reset */ assign viCounter = integer(viCounter) no-error.