Write Logs In File
Categories
Component ID
Component name
Component type
Maintenance status
Development status
Component security advisory coverage
Component created
Component changed
Component body
Description
===========
This is experimental code for developer only
Installation
============
Standard module installation procedure. Copy the module to modules directory,
and enable.
It is very useful while debugging the code, some time we don't get what's happening under the code, anyway it doesn't get track.
Use the write_logs($error_log) function in your code to write log in text file which will located at "tmp" directory.
So can you easily read it and get where is the your issue.
Features:
1) It's lightweight
2) No dependency of other modules
3) Readable log output format, you can change it as per your need.
/**
* [$error_log Use below code where user to track code log]
* @type {Function}
*/
$error_log = array(
'date' => date('Y-m-d h:m:s') ,
'file_name' => $_SERVER['SCRIPT_FILENAME'],
'ip_address' => $_SERVER['REMOTE_ADDR'] . ' - ' . date("F j, Y, g:i:s a") ,
'Message' => "Calling inside " . FUNCTION,
'method' => FUNCTION,
'session' => $_SESSION,
'url_access' => $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'],
//'file_access' => FILE,
//'line_access' => LINE
);
write_logs($error_log);
