I am trying to log some user activity in a file, like one activity per line
I am using the file helper in order to do so
$this->load->helper('file');
$logline = '[' . date('Y-m-d H:i:s.v') . '] ' . $data['user_id'] . ' | ' . $data['activity'] . '\n';
$logpath = './application/logs/application_activity.log';
return write_file($logpath, $logline, 'a+');
And in my output file, it litterally writes the \n
at the end of the line, like this
[2022-03-03 08:49:26.000] Super Administrateur | Validated citizen 1195078 as duplicate\n
How to just make it create a new line at the end of the file?
Side note: if you know where it would be more appropriate to write the logs, please be me guest