Welcome Guest, Not a member yet? Register   Sign In
Modify the Log message (error, critical exceptions, etc)
#3

(This post was last modified: 10-29-2023, 06:40 AM by 5flex.)

(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!
Reply


Messages In This Thread
RE: Modify the Log message (error, critical exceptions, etc) - by 5flex - 10-29-2023, 06:39 AM



Theme © iAndrew 2016 - Forum software by © MyBB