| @@ 101-113 (lines=13) @@ | ||
| 98 | * @return \Monolog\Logger |
|
| 99 | * @throws \Longman\TelegramBot\Exception\TelegramLogException |
|
| 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 |
|
| @@ 123-135 (lines=13) @@ | ||
| 120 | * @return \Monolog\Logger |
|
| 121 | * @throws \Longman\TelegramBot\Exception\TelegramLogException |
|
| 122 | */ |
|
| 123 | public static function initDebugLog($path) |
|
| 124 | { |
|
| 125 | if ($path === null || $path === '') { |
|
| 126 | throw new TelegramLogException('Empty path for debug log'); |
|
| 127 | } |
|
| 128 | self::initialize(); |
|
| 129 | self::$debug_log_path = $path; |
|
| 130 | ||
| 131 | return self::$monolog->pushHandler( |
|
| 132 | (new StreamHandler(self::$debug_log_path, Logger::DEBUG)) |
|
| 133 | ->setFormatter(new LineFormatter(null, null, true)) |
|
| 134 | ); |
|
| 135 | } |
|
| 136 | ||
| 137 | /** |
|
| 138 | * Get the stream handle of the temporary debug output |
|