forked from luofei614/SocketLog
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathslog.function.php
More file actions
32 lines (27 loc) · 902 Bytes
/
Copy pathslog.function.php
File metadata and controls
32 lines (27 loc) · 902 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
require 'slog.php';
use think\org\Slog;
function slog($log,$type='log',$css='')
{
if(is_string($type))
{
$type=preg_replace_callback('/_([a-zA-Z])/',create_function('$matches', 'return strtoupper($matches[1]);'),$type);
if(method_exists('\think\org\Slog',$type) || in_array($type,Slog::$log_types))
{
return call_user_func(array('\think\org\Slog',$type),$log,$css);
}
}
if(is_object($type) && 'mysqli'==get_class($type))
{
return Slog::mysqlilog($log,$type);
}
if(is_resource($type) && ('mysql link'==get_resource_type($type) || 'mysql link persistent'==get_resource_type($type)))
{
return Slog::mysqllog($log,$type);
}
if(is_object($type) && 'PDO'==get_class($type))
{
return Slog::pdolog($log,$type);
}
throw new Exception($type.' is not SocketLog method');
}