I am developing a custom module and I want to write debugging output to a log file so I can monitor it in real time, and not wait to navigate to watchdog.
I was using file_save_data()
to write to the public file system, but quickly noticed that it was making log1.txt
, log2.txt
, log3.txt
, etc. I want all my log messages to go into the same file. I looked at the documentation, and saw that the only flags that exist are FILE_EXISTS_REPLACE
, FILE_EXISTS_RENAME
, and FILE_EXISTS_ERROR
. Sadly for me, no FILE_EXISTS_APPEND
.
What is the drupal way to append data to a file on the file system? Or should I just use native php functions?