ACC SHELL
<?php
require_once ('Zend/Debug.php');
class TF_Debug extends Zend_Debug
{
private static $logger = null;
public static function init ()
{
if(DEBUGMODE){
$writer = new Zend_Log_Writer_Firebug();
$writer->setDefaultPriorityStyle('TRACE');
$writer->setEnabled(true);
$writer->setPriorityStyle(8, 'TABLE');
$writer->setPriorityStyle(9, 'TRACE');
} else {
$writer = new Zend_Log_Writer_Null();
}
$logger = new Zend_Log($writer);
$logger->addPriority('TABLE', 8);
$logger->addPriority('TRACE', 9);
self::$logger = $logger;
}
public static function dump ($var)
{
$bt = debug_backtrace();
$line = $bt[1]['line'];
$class = $bt[1]['class'];
$function = $bt[1]['function'];
die($line . ': ' . $class . '->' . $function . parent::dump($var, "DEBUG:", 0));
}
public static function logAlert ($text)
{
if (DEBUGMODE) {
$bt = debug_backtrace();
$line = $bt[1]['line'];
$class = $bt[1]['class'];
$function = $bt[1]['function'];
self::$logger->log($line . ': ' . $class . '->' . $function . "\r\n" . $text,
Zend_Log::ALERT);
}
}
public static function logNotice ($text)
{
if (DEBUGMODE) {
$bt = debug_backtrace();
$line = $bt[1]['line'];
$class = $bt[1]['class'];
$function = $bt[1]['function'];
self::$logger->log($line . ': ' . $class . '->' . $function . "\r\n"."\r\n",
Zend_Log::NOTICE);
self::$logger->log($text,Zend_Log::NOTICE);
}
}
public static function logError ($text)
{
if (DEBUGMODE) {
$bt = debug_backtrace();
$line = $bt[1]['line'];
$class = $bt[1]['class'];
$function = $bt[1]['function'];
self::$logger->log( $text, 9);
}
}
public static function logTable($table){
self::$logger->table($table);
}
public static function logSimple($data){
self::$logger->debug($data, Zend_Log::DEBUG);
}
public static function getLogger(){
return self::$logger;
}
public static function logForbidden()
{
//TODO log 403 somewhere
}
public static function logNotFound()
{
//TODO log 404 somewhere
}
}
ACC SHELL 2018