Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions demo.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@
slog('msg','alert');//将日志以alert方式弹出
slog('msg','log','color:red;font-size:20px;');//自定义日志的样式,第三个参数为css样式

$i=5;
while($i){
$typeArr = ['log','info','error','warn'];
$key = array_rand($typeArr,1);
echo $i;
slog(['hello word'.$i, 1, 2, [1,4,5]], $typeArr[$key]);
$i--;
sleep(1);
}

//调试sql
/*
$link=mysql_connect( 'localhost:3306' , 'root' , '123456' , true ) ;
Expand Down
7 changes: 5 additions & 2 deletions php/slog.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ public static function __callStatic($method,$args)
if(in_array($method,self::$log_types))
{
array_unshift($args,$method);
return call_user_func_array(array(self::getInstance(),'record'),$args);
$ret = call_user_func_array(array(self::getInstance(),'record'),$args);
self::sendLog();
self::$logs=[];
return $ret;
}
}

Expand Down Expand Up @@ -489,7 +492,7 @@ protected static function sendToClient($tabid, $client_id, $logs, $force_client_

public function __destruct()
{
self::sendLog();
// self::sendLog();
}

}
Expand Down