I have created a ST program in Automation Studio and ported the example code for ArEventLog into it. The program is able to compile. I was wondering how I could modify this for logging a message from another .as or .st program. Is it possible to create a function that can be called from another automation basic program to perform logging? Would it be callable in C/C++ also?
When running the example program, should I see ‘This is an information entry from the user.’ log message?
I managed to display some logs from the same test program by setting the following in PROGRAM_INIT:
EventLog.Commands.CreateUserLog := TRUE;
EventLog.Commands.WriteUserEvent := TRUE;
you can create a user library starting from this sample task.
With a user library it would be possible to use the logging in every task you have.
Without a library you would need to create logbooks per task, share the ident for the logbook or acquire the ident using the name of logbook in each task.
I personally would go with the library option. The IEC conform library should be usable in IEC and also in a C/C++ program.