test-php-rest-api-user/engine/class/0002.debug.php

38 lines
825 B
PHP

<?php
// REQUIREMENTS:
// 0001.db.php
class Debug {
public static function init() {
if(!Root::installed())
self::createTables();
}
public static function createTables() {
DB::getQuery('main',
'CREATE TABLE IF NOT EXISTS `debug_log` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`value` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
PRIMARY KEY (`id`)
)
ENGINE = InnoDB
CHARSET=utf8
COLLATE utf8_general_ci'
);
}
public static function print($a, $b = false) {
echo '<pre>';
$b ? var_dump($a) : print_r($a);
echo '</pre>';
}
public static function log($string) {
$string = date('H:i:s d.m.Y', time()).' | '.$string;
DB::getQuery('main', 'INSERT INTO `debug_log` (`value`) VALUES (?)', $string);
return true;
}
}
// Debug::init();