This behavior is actually handled by the Drupal Log module (one of farmOS’s dependencies, but not specifically farmOS): https://www.drupal.org/project/log/
This is handled in
hook_log_insert() (which runs when a new Log entity is inserted in the database) and
hook_log_update() (when an existing Log is updated):
Both of these hooks delegate to the
log_name_generate() function: log.module · 04117ccd01316c78ac68efbb5d1e25c0a3a041f7 · project / log · GitLab
So these only fire AFTER the form is submitted, but it sounds like you want to pre-fill the form with the same value. You may be able to do this with a custom implementation of
hook_form_alter() - this will fire whenever a form is built in the system. So you would want to limit it to only fire when the Log edit form is built AND you would want to make sure it only runs if the field is empty, otherwise it could overwrite previously saved values.
Here’s the Drupal doc page for
Hope that helps!