in reply to Appending time to each line
If you replace all \n in $message with "\n".current_time you should get the desired output. A trailing \n needs to be exempted.