4
I want to know if it is possible to know the line and file that is running a method. For example, I have a class Log
, with it I log users' logs.
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: THE CLASS ARTE
EXTENDS THE CLASS LOG
When you entered this line, I would like the variable $this->orig
had the following value:
File: C: xampp htdocs projeto app class Arte.php Line: 85
But comes the value:
File: C: xampp htdocs app project class Log.php Line: 19
Is it possible to do this? Is there any other alternative I can do?
PS.: If possible I would like to not pass this information by parameters, as it would have to touch a lot of things.
Firing an Exception does not solve the problem?
– Papa Charlie