| @@ 101-113 (lines=13) @@ | ||
| 98 | * @throws \InvalidArgumentException |
|
| 99 | * @throws \Exception |
|
| 100 | */ |
|
| 101 | public static function initErrorLog($path) |
|
| 102 | { |
|
| 103 | if ($path === null || $path === '') { |
|
| 104 | throw new TelegramLogException('Empty path for error log'); |
|
| 105 | } |
|
| 106 | self::initialize(); |
|
| 107 | self::$error_log_path = $path; |
|
| 108 | ||
| 109 | return self::$monolog->pushHandler( |
|
| 110 | (new StreamHandler(self::$error_log_path, Logger::ERROR)) |
|
| 111 | ->setFormatter(new LineFormatter(null, null, true)) |
|
| 112 | ); |
|
| 113 | } |
|
| 114 | ||
| 115 | /** |
|
| 116 | * Initialize debug log |
|
| @@ 125-137 (lines=13) @@ | ||
| 122 | * @throws \InvalidArgumentException |
|
| 123 | * @throws \Exception |
|
| 124 | */ |
|
| 125 | public static function initDebugLog($path) |
|
| 126 | { |
|
| 127 | if ($path === null || $path === '') { |
|
| 128 | throw new TelegramLogException('Empty path for debug log'); |
|
| 129 | } |
|
| 130 | self::initialize(); |
|
| 131 | self::$debug_log_path = $path; |
|
| 132 | ||
| 133 | return self::$monolog->pushHandler( |
|
| 134 | (new StreamHandler(self::$debug_log_path, Logger::DEBUG)) |
|
| 135 | ->setFormatter(new LineFormatter(null, null, true)) |
|
| 136 | ); |
|
| 137 | } |
|
| 138 | ||
| 139 | /** |
|
| 140 | * Get the stream handle of the temporary debug output |
|