I want to know if it is possible to know the line and file that a method is executing. For example, I have a class Log
, with it I make log records of the users.
Log.php
<?php
/**
* Classe de Logs
*/
class Log
{
var $con;
private $error, $orig;
function __construct($userid = NULL) {
global $con;
$this->con = $con;
$this->obs = '';
}
function SetError($error, $type = 1, $concat = FALSE, $register = TRUE){
$this->error = ($concat ? $this->error."\n ".$error : $error);
$this->orig = 'Arquivo: '.__FILE__."\n Linha: ".__LINE__;
if($register) $this->RegisterLog($error);
return FALSE;
}
Arte.php (line 85)
} else return $this->SetError('Não foi possível carregar os produtos.');
NOTE: CLASS% with% EXTEND CLASS ARTE
When you enter this line, I would like the LOG
variable to have the following value:
File: C: \ xampp \ htdocs \ project \ app \ class \ Arte.php Line: 85
But the value comes:
File: C: \ xampp \ htdocs \ project \ app \ class \ Log.php Line: 19
Is it possible to do this? Are there any other alternatives I can do?
PS.: If possible I would like to not pass this information through parameters, as I would have to move a lot.