Welcome Guest, Not a member yet? Register   Sign In
log message of current class and function and line number
#1

Dear all,

I am going to use log message function in codeigniter.
Is it possible to log current class and function and line number and error exception messages in the log so that I does not need to hard code these in the message??
Reply
#2

CI3's default error and exception handlers already do this. If you look at /system/core/Common.php, the _exception_handler() function loads the Exceptions class and calls its log_exception() method, using the relevant methods on the $exception argument passed to the handler. At the very least, that should serve as an example for how to get the information from an Exception in your own code. The methods are also defined in PHP's manual, in the documentation of the Exception class.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB