Php 如何向OpenCart错误日志添加注释?
在Laravel中,我可以使用Php 如何向OpenCart错误日志添加注释?,php,opencart,opencart2.x,Php,Opencart,Opencart2.x,在Laravel中,我可以使用log()命令向日志文件添加注释(这有助于我进行调试),如下所示: $var = 'this is a variable'; //some other code goes here log::('Is $var a null? Here is the value '.$var); 然后我可以签入日志文件 如何在OpenCart中执行此操作?在OpenCart 2和3中,在/system/library/log.php中有日志库 该库几乎可以从任何地方(从任何模型和
log()
命令向日志文件添加注释(这有助于我进行调试),如下所示:
$var = 'this is a variable';
//some other code goes here
log::('Is $var a null? Here is the value '.$var);
然后我可以签入日志文件
如何在OpenCart中执行此操作?在OpenCart 2和3中,在/system/library/log.php中有日志库 该库几乎可以从任何地方(从任何模型和控制器)访问。您可以像这样轻松地使用它:
$var = 'this is a variable';
//some other code goes here
$this->log->write('Is $var a null? Here is the value '.$var);
可以在/system/storage/logs/error.Log中找到日志文件
另一种方式
$var = 'this is a variable';
//some other code goes here
$log = new Log('LOG_NAME.log');
$log->write('Is $var a null? Here is the value '.$var);
您将在/system/storage/logs中找到日志文件/