.
*/
class ryLogger {
public $enable = false;
private $logs = array();
private static $_instance = NULL;
public static function getInstance() {
if (self::$_instance === NULL)
self::$_instance = new ryLogger();
return self::$_instance;
}
function addLog($log, $indent=NULL) {
if ($indent !== NULL)
$this->log_indent += $indent;
if ($log) {
$tabs = str_repeat(" ", $this->log_indent);
$a = $tabs.str_replace("\n", "\n ".$tabs, $log);
$this->logs[] = ''.$a.'';
}
}
function addPrint($log, $color='#FFFF00') {
$this->logs[] = ''.$log.'';
}
function addError($log) {
$this->logs[] = ' ERROR: '.$log.'';
}
function getLogs() {
$ret = '';
if ($this->logs && $this->enable) {
$ret = 'Debug
'. implode(''; $this->logs = array(); } return $ret; } } function _log() { return ryLogger::getInstance(); } ?>
', $this->logs).'