FUNCTION ADSLOGSTR : DINT
This is a Beckhoff dependent function which must be replaced by a vanilla codesys function
This function issues when called a message box holding a specifiable text on the screen, and writes an entry into the system’s log. In the text to be given out, a string (a sequence of characters) can be inserted in the text at a point specified by the user. For this purpose the stored format must contain the characters ‘%s’ at the desired location. Always remember that here too, as illustrated in the example, the function must be called using edge-control (see also the note in the description of ADSLOGDINT). The result value contains the function error code, or, if successful, 0.
FUNCTION ADSLOGSTR : DINT VAR_INPUT msgCtrlMask : DWORD; msgFmtStr : T_MaxString; strArg : T_MaxString; END_VAR
msgCtrlMask : Control mask which determines the type and effect of the message output (see separate table: ADSLOGDINT).
msgFmtStr : Contains the message to be issued. It can contain the formatting code ‘%d’ for the output of a DINT value at any position.alten.
strArg : Contains the string which is to be inserted into the message.
Actually for this I think I may found a solution.
I'm creating a new logger in Codesys Log and save all the messages there.
You just have to use the function LOGSTR. The rest of the objects will be hidden for the users when they will be saved in a library.
Have a look and test it and if you have any issues or questions tell me.
Hi,
The idea is very good!
I have added the library references and missing declarions in order to get the demo running. However, I had an issue: the online log of the RPi is not filled up with messages from the component when trigger from the testapplication.
This offcourse should be fixed.
Plus, I don't know why you have declared a function block into a struct. That is a programming technique which unknown to me.
See attached export for my testapplication
UPDATE
Forum post on StdLogger functionality
https://forum.codesys.com/viewtopic.php?t=6810#p14522
I don't have an RPi on my hands and all my tests were made on a Control Win V3. But I'm glad you made it run.
To be honest, I just wanted to keep things toghether knowing that this structure will not be seen by the users.