Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

ErrorLog

Queries error log.

Component Version macOS Windows Linux Server iOS SDK
Plugin 12.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "ErrorLog" )

Parameters

none

Result

Returns JSON or error.

Description

Queries error log.
Error log gets activated with ClearErrors, which also clears all entries.
Please call ClearErrors function on beginning of a script and then on the end of the script, use HadErrors function to check if there was a problem. Use this function to query JSON with error details.

Querying the error log using ErrorLog function turns it off until the next call to ClearErrors function. You can add own entries with AddToErrorLog function.

Errors are tracked per thread, so on a server each PSoS session has its own error log. And it includes errors from subscripts.

Our error log is in addition to trace functions and Plugin.SetErrorScriptTrigger function.

Examples

Try the error log:

# test Errors in file Kontakte

# start error logging
Set Variable [ $r ; Value: MBS("ClearErrors") ]
#
# cause some errors
Set Variable [ $r ; Value: MBS("test"; 1; "Hello") ]
Set Variable [ $r ; Value: MBS("DynaPDF.Print"; 1; "Hello") ]
#
# now query error log
Set Variable [ $r ; Value: MBS("ErrorLog") ]
Show Custom Dialog [ "Error Log" ; $r ]

Example result:
[ { "function": "test", "result": "[MBS] Unknown function: test", "parameter": ["test", 1, "Hello"], "fileName": "Kontakte", "scriptName": "test Errors", "currentTimeStamp": "23.06.2022 09:28:34" }, { "function": "DynaPDF.Print", "result": "[MBS] DynaPDF.Print is only supported for Windows. Please use PDFKit.Print on Mac.", "parameter": [ "DynaPDF.Print", 1, "Hello" ], "fileName": "Kontakte", "scriptName": "test Errors", "currentTimeStamp": "23.06.2022 09:28:34" } ]

See also

Release notes

Blog Entries

This function is free to use.

Created 23th June 2022, last changed 14th March 2024


EnvironmentVariables.Value - EventMonitor.Clear