I would suggest to just trim the last newline of a script if there is already one or just replace a double newline at the end of a script output.
Other possibility is to separate script engine internal related stuff from the user script output and write the raw script output to additional log files (i.e. homegear-scriptoutput.log and homegear-scriptoutput.err) and let the user script handle the complete formatting if required.
If script output ends with a newline, the script log file contains an empty line. I assume to every script output a newline is pre- or appended.
homegear-scriptengine.log:
I would suggest to just trim the last newline of a script if there is already one or just replace a double newline at the end of a script output.
Other possibility is to separate script engine internal related stuff from the user script output and write the raw script output to additional log files (i.e.
homegear-scriptoutput.log
andhomegear-scriptoutput.err
) and let the user script handle the complete formatting if required.