Store user messages along with process instance

We would like to connect our UI to Camunda only (via Rest API). The user has to be informed of certain events that either the process or a service task raises.

Example 1: the user is to be informed that the process started with a certain business key.
Example 2: a service tasks validates data and shall inform the user about some irregularities.

in both cases only a warning is required to be displayed in an continuously updating log element in the UI.

My question is, if there already is a Camunda function that we can use to store such messages related to a process instance, or if there are existing objects that we could utilize for message logging. I see that it is possible to grab all sort of data from the process instance history, but nothing looked exactly suitable for logging.

The alternative is to use an additional service for message queuing / logging, but then the UI must connect to multiple services and the process instance log is not directly bound to the process instance.

I haven’t noticed the task comment functionality before. I guess that could be suitable, but it does not look like the comments are available in the history.

Another option could be using a process instance variable. A json type could act a s a collection of log messages. An easy ways to dump new entries into the log (from inside the process) is required though. Could that be accomplished, maybe with javascript task that takes a log message and adds it to a log a collection inside the json?