-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathL.php
104 lines (96 loc) · 3.21 KB
/
L.php
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?php
/**
* SLogger shortcut functions
*/
class L
{
/**
* @static
* @return SLogger
*/
protected static function getLogger()
{
return Yii::app()->getComponent('slog');
}
/**
* Log message
*
* @param mixed $message message to log
* @param string|null $target target name (file, category, etc)
* @param string $from string from __METHOD__ constant
* @param array|null $data addition data to handler
* @return int success processed handlers
*/
public static function trace($message, $target = null, $from = null, $data = null)
{
return self::getLogger()->write($message, $target, SLogger::TRACE, $from, $data);
}
/**
* Log message
*
* @param mixed $message message to log
* @param string|null $target target name (file, category, etc)
* @param string $from string from __METHOD__ constant
* @param array|null $data addition data to handler
* @return int success processed handlers
*/
public static function log($message, $target = null, $from = null, $data = null)
{
return self::getLogger()->write($message, $target, SLogger::LOG, $from, $data);
}
/**
* Log message
*
* @param mixed $message message to log
* @param string|null $target target name (file, category, etc)
* @param string $from string from __METHOD__ constant
* @param array|null $data addition data to handler
* @return int success processed handlers
*/
public static function error($message, $target = null, $from = null, $data = null)
{
return self::getLogger()->write($message, $target, SLogger::ERROR, $from, $data);
}
/**
* Log message
*
* @param mixed $message message to log
* @param string|null $target target name (file, category, etc)
* @param string $from string from __METHOD__ constant
* @param array|null $data addition data to handler
* @return int success processed handlers
*/
public static function success($message, $target = null, $from = null, $data = null)
{
return self::getLogger()->write($message, $target, SLogger::SUCCESS, $from, $data);
}
/**
* Log message
*
* @param mixed $message message to log
* @param string|null $target target name (file, category, etc)
* @param string $from string from __METHOD__ constant
* @param array|null $data addition data to handler
* @return int success processed handlers
*/
public static function fatal($message, $target = null, $from = null, $data = null)
{
return self::getLogger()->write($message, $target, SLogger::FATAL, $from, $data);
}
/**
* Log message with custom status
*
* @param mixed $name
* @param array $args
* @return int success processed handlers
*/
public static function __callStatic($name, $args)
{
$message = isset($args[0]) ? $args[0] : null;
$target = isset($args[1]) ? $args[1] : null;
$level = $name;
$from = isset($args[2]) ? $args[2] : null;
$data = isset($args[3]) ? $args[3] : null;
return self::getLogger()->write($message, $target, $level, $from, $data);
}
}