|
@@ 118-133 (lines=16) @@
|
| 115 |
|
* @return Logger |
| 116 |
|
* @throws TelegramLogException |
| 117 |
|
*/ |
| 118 |
|
public static function initErrorLog($path, HandlerInterface $external_handler = null) |
| 119 |
|
{ |
| 120 |
|
if ($path === null || $path === '') { |
| 121 |
|
throw new TelegramLogException('Empty path for error log'); |
| 122 |
|
} |
| 123 |
|
self::initialize(); |
| 124 |
|
self::$error_log_path = $path; |
| 125 |
|
|
| 126 |
|
if (is_null($external_handler)) { |
| 127 |
|
$handler = new StreamHandler(self::$error_log_path, Logger::ERROR); |
| 128 |
|
} else { |
| 129 |
|
$handler = $external_handler; |
| 130 |
|
} |
| 131 |
|
|
| 132 |
|
return self::$monolog->pushHandler($handler->setFormatter(new LineFormatter(null, null, true))); |
| 133 |
|
} |
| 134 |
|
|
| 135 |
|
/** |
| 136 |
|
* Initialize debug log |
|
@@ 144-159 (lines=16) @@
|
| 141 |
|
* @return Logger |
| 142 |
|
* @throws TelegramLogException |
| 143 |
|
*/ |
| 144 |
|
public static function initDebugLog($path, HandlerInterface $external_handler = null) |
| 145 |
|
{ |
| 146 |
|
if ($path === null || $path === '') { |
| 147 |
|
throw new TelegramLogException('Empty path for debug log'); |
| 148 |
|
} |
| 149 |
|
self::initialize(); |
| 150 |
|
self::$debug_log_path = $path; |
| 151 |
|
|
| 152 |
|
if (is_null($external_handler)) { |
| 153 |
|
$handler = new StreamHandler(self::$debug_log_path, Logger::DEBUG); |
| 154 |
|
} else { |
| 155 |
|
$handler = $external_handler; |
| 156 |
|
} |
| 157 |
|
|
| 158 |
|
return self::$monolog->pushHandler($handler->setFormatter(new LineFormatter(null, null, true))); |
| 159 |
|
} |
| 160 |
|
|
| 161 |
|
/** |
| 162 |
|
* Get the stream handle of the temporary debug output |