1 | <?php |
||
20 | class MongoLog |
||
21 | { |
||
22 | /** |
||
23 | * @link http://php.net/manual/en/class.mongolog.php#mongolog.constants.none |
||
24 | */ |
||
25 | const NONE = 0; |
||
26 | |||
27 | /** |
||
28 | * @link http://php.net/manual/en/class.mongolog.php#mongolog.constants.all |
||
29 | */ |
||
30 | const ALL = 31; |
||
31 | |||
32 | /** |
||
33 | * @link http://php.net/manual/en/class.mongolog.php#mongolog.constants.warning |
||
34 | */ |
||
35 | const WARNING = 1; |
||
36 | |||
37 | /** |
||
38 | * @link http://php.net/manual/en/class.mongolog.php#mongolog.constants.info |
||
39 | */ |
||
40 | const INFO = 2; |
||
41 | |||
42 | /** |
||
43 | * @link http://php.net/manual/en/class.mongolog.php#mongolog.constants.fine |
||
44 | */ |
||
45 | const FINE = 4; |
||
46 | |||
47 | /** |
||
48 | * @link http://php.net/manual/en/class.mongolog.php#mongolog.constants.rs |
||
49 | */ |
||
50 | const RS = 1; |
||
51 | |||
52 | /** |
||
53 | * @link http://php.net/manual/en/class.mongolog.php#mongolog.constants.pool |
||
54 | */ |
||
55 | const POOL = 1; |
||
56 | |||
57 | /** |
||
58 | * @link http://php.net/manual/en/class.mongolog.php#mongolog.constants.con |
||
59 | */ |
||
60 | const CON = 2; |
||
61 | |||
62 | /** |
||
63 | * @link http://php.net/manual/en/class.mongolog.php#mongolog.constants.io |
||
64 | */ |
||
65 | const IO = 4; |
||
66 | |||
67 | /** |
||
68 | * @link http://php.net/manual/en/class.mongolog.php#mongolog.constants.server |
||
69 | */ |
||
70 | const SERVER = 8; |
||
71 | |||
72 | /** |
||
73 | * @link http://php.net/manual/en/class.mongolog.php#mongolog.constants.parse |
||
74 | */ |
||
75 | const PARSE = 16; |
||
76 | |||
77 | |||
78 | private static $callback; |
||
79 | private static $level; |
||
80 | private static $module; |
||
81 | |||
82 | /** |
||
83 | * (PECL mongo >= 1.3.0) |
||
84 | * Gets the previously set callback function |
||
85 | * |
||
86 | * @return callable|null |
||
87 | */ |
||
88 | public static function getCallback() |
||
92 | |||
93 | /** |
||
94 | * (PECL mongo >= 1.3.0)<br/> |
||
95 | * <p> |
||
96 | * This function will set a callback function to be called for {@link http://www.php.net/manual/en/class.mongolog.php MongoLog} events |
||
97 | * instead of triggering warnings. |
||
98 | * </p> |
||
99 | * @link http://www.php.net/manual/en/mongolog.setcallback.php |
||
100 | * @param callable $log_function <p> |
||
101 | * The function to be called on events. |
||
102 | * </p> |
||
103 | * <p> |
||
104 | * The function should have the following prototype |
||
105 | * </p> |
||
106 | * |
||
107 | * <em>log_function</em> ( <em>int</em> <em>$module</em> , <em>int</em> <em>$level</em>, <em>string</em> <em>$message</em>) |
||
108 | * <ul> |
||
109 | * <li> |
||
110 | * <b><i>module</i></b> |
||
111 | * |
||
112 | * <p>One of the {@link http://www.php.net/manual/en/class.mongolog.php#mongolog.constants.module MongoLog module constants}.</p> |
||
113 | * </li> |
||
114 | * <li> |
||
115 | * <b><i>level</i></b> |
||
116 | * |
||
117 | * <p>One of the {@link http://www.php.net/manual/en/class.mongolog.php#mongolog.constants.level MongoLog level constants}.</p> |
||
118 | * </li |
||
119 | * <li> |
||
120 | * <b><i>message</i></b> |
||
121 | * |
||
122 | * <p>The log message itself.</p></li> |
||
123 | * <ul> |
||
124 | * @return boolean Returns <b>TRUE</b> on success or <b>FALSE</b> on failure. |
||
125 | */ |
||
126 | public static function setCallback(callable $log_function) |
||
131 | |||
132 | /** |
||
133 | * This function can be used to set how verbose logging should be and the types of |
||
134 | * activities that should be logged. Use the constants described in the MongoLog |
||
135 | * section with bitwise operators to specify levels. |
||
136 | * |
||
137 | * @link http://php.net/manual/en/mongolog.setlevel.php |
||
138 | * @static |
||
139 | * @param int $level The levels you would like to log |
||
140 | * @return void |
||
141 | */ |
||
142 | public static function setLevel($level) |
||
146 | |||
147 | /** |
||
148 | * This can be used to see the log level. Use the constants described in the |
||
149 | * MongoLog section with bitwise operators to check the level. |
||
150 | * |
||
151 | * @link http://php.net/manual/en/mongolog.getlevel.php |
||
152 | * @static |
||
153 | * @return int Returns the current level |
||
154 | */ |
||
155 | public static function getLevel() |
||
159 | |||
160 | /** |
||
161 | * This function can be used to set which parts of the driver's functionality |
||
162 | * should be logged. Use the constants described in the MongoLog section with |
||
163 | * bitwise operators to specify modules. |
||
164 | * |
||
165 | * @link http://php.net/manual/en/mongolog.setmodule.php |
||
166 | * @static |
||
167 | * @param int $module The module(s) you would like to log |
||
168 | * @return void |
||
169 | */ |
||
170 | public static function setModule($module) |
||
174 | |||
175 | /** |
||
176 | * This function can be used to see which parts of the driver's functionality are |
||
177 | * being logged. Use the constants described in the MongoLog section with bitwise |
||
178 | * operators to check if specific modules are being logged. |
||
179 | * |
||
180 | * @link http://php.net/manual/en/mongolog.getmodule.php |
||
181 | * @static |
||
182 | * @return int Returns the modules currently being logged |
||
183 | */ |
||
184 | public static function getModule() |
||
188 | } |
||
189 |