(10-19-2023, 11:47 AM)Luppo Wrote: What is the recommended method to extend the file log to automatically append additional debug information to the log messages (ie IP address and current URL)? I want to keep exactly the same functionality, just adding some dynamic text to the log messages.
It's very simple task... Go to app folder and open exist file Common.php. Add to file:
PHP Code:
function log_message($level, $message, $context = []): void
{
$message = "[". $_SERVER['REMOTE_ADDR']."] ".$message;
$logger = service('logger');
$logger->log($level, $message, $context);
}
and on exit you get (as example...):
Code:
DEBUG - 2023-10-29 07:14:52 --> [192.168.0.1] This your debug message....
Your existing function call log_message() function DON'T NEED CHANGE AT ALL!