|
OpenSencillo
2015.002
|
Inheritance diagram for log:Public Member Functions | |
| __construct ($path='', $file='log.txt', $maxLine=100, $useFile=true, $mysql=null) | |
| saveToLog ($data) | |
| getLog () | |
| vd ($var) | |
Protected Attributes | |
| $name | |
| $file | |
| $path | |
| $current | |
| $store = array() | |
| $maxLine = 0 | |
| $useFile | |
Private Member Functions | |
| getContent () | |
Log class
Definition at line 5 of file test.tool.framework.php.
| __construct | ( | $ | path = '', |
| $ | file = 'log.txt', |
||
| $ | maxLine = 100, |
||
| $ | useFile = true, |
||
| $ | mysql = null |
||
| ) | [final] |
| getContent | ( | ) | [private] |
Read log file
Definition at line 72 of file test.tool.framework.php.
| getLog | ( | ) |
Load from log
Definition at line 94 of file test.tool.framework.php.
{
$this->getContent();
return $this->store;
}
| saveToLog | ( | $ | data | ) | [final] |
Save to log
| string | $data |
Definition at line 35 of file test.tool.framework.php.
{
if($this->useFile)
{
$this->getContent();
$this->current = fopen($this->file, "w");
fprintf($this->current, "%s\t%s\t%s\t%s\t%s\t%s\n",date('Y-m-d'),date('H:i:s'),$data[0],$data[1],$data[2],$data[3]);
foreach ($this->store as $val)
{
fprintf($this->current, "%s\t%s\t%s\t%s\t%s\t%s\n",$val[0],$val[1],$val[2],$val[3],$val[4],$val[5]);
}
fclose($this->current);
if($this->maxLine<sizeof($this->store))
{
rename($_SERVER['DOCUMENT_ROOT'] . $this->file,$_SERVER['DOCUMENT_ROOT'] . $this->path ."old_" . $this->name);
}
}
else
{
$name=explode('.',$this->name);
$this->store['mysql']->newColumn('date','VARCHAR(10)');
$this->store['mysql']->newColumn('time','VARCHAR(8)');
$this->store['mysql']->newColumn('data0','TEXT');
$this->store['mysql']->newColumn('data1','TEXT');
$this->store['mysql']->newColumn('data2','TEXT');
$this->store['mysql']->newColumn('data3','TEXT');
$this->store['mysql']->createTable($name[0].'_log');
$this->store['mysql']->openTable($name[0].'_log');
$this->store['mysql']->insert('\''.date('Y-m-d').'\',\''.date('H:i:s').'\',\''.$data[0].'\',\''.$data[1].'\',\''.$data[2].'\',\''.$data[3].'\'');
}
}
| vd | ( | $ | var | ) |
Get formated var_dump to string
Definition at line 103 of file test.tool.framework.php.
{
ob_start();
var_dump($var);
$result = ob_get_clean();
$result = highlight_string($result,true);
$result = str_replace('=><br /> ','<b>=></b>',$result);
$result = str_replace(') "',') "<font color="blue">',$result);
$result = str_replace('"<br />','</font>"<br />',$result);
echo $result;
return $result;
}
$current [protected] |
Definition at line 10 of file test.tool.framework.php.
$file [protected] |
Definition at line 8 of file test.tool.framework.php.
$maxLine = 0 [protected] |
Definition at line 12 of file test.tool.framework.php.
$name [protected] |
Definition at line 7 of file test.tool.framework.php.
$path [protected] |
Definition at line 9 of file test.tool.framework.php.
$store = array() [protected] |
Definition at line 11 of file test.tool.framework.php.
$useFile [protected] |
Definition at line 13 of file test.tool.framework.php.