API log

Hello, I am using the ‘PEAR2_Net_RouterOS’ API and I would like to record the API actions in the mikrotik log, does anyone know how I can write a line in the log from the API? Greetings and thank you very much in advance

Any API commands or just commands which performs config changes? As I see there is no api topic for ROS Logging so I guess any API executed commands cannot be traced (unless maybe on some debug topic), but API commands for config changes can be listed from /system/history filtered by specific user created for API - redo property contains executed command, undo contains command for restoring prev. config state, by contains user which performed command, time when…

Thank you very much for your response, I would like to record in more detail the activities that are carried out through the API.
It occurred to me to run a script with the API and have that script write the log, only that it would be necessary to pass arguments such as the message to the script, would there be a way to do that?

Create some API command wrapper ROS script which handles variable (eg. apicmd) as command which needs to be performed from API, like :log info “Executing API command: $apicmd”; :execute $apicmd as-string. Run wrapper script source with Util.exec() function from this PHP library and set variable with same name as in wrapper script (apicmd) into $params Array argument for this function with content of ROS command which needs to be performed. Then you can create own util function with API command argument which wraps Util.exec() in such way.

Perfect, I’m going to try it, greetings and thank you very much