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