Commit 5bdfccf4 authored by MBoretto's avatar MBoretto

Merge branch 'monolog' of https://github.com/MBoretto/php-telegram-bot into monolog

parents 3b517ce5 4abfd919
......@@ -10,7 +10,6 @@
namespace Longman\TelegramBot;
use Longman\TelegramBot\TelegramBot;
use Longman\TelegramBot\Entities\File;
use Longman\TelegramBot\Entities\ServerResponse;
use Longman\TelegramBot\Exception\TelegramException;
......@@ -177,9 +176,9 @@ class Request
}
if (TelegramLog::isDebugLogActive()) {
$curlConfig[CURLOPT_VERBOSE] = true;
$verbose_curl_output = fopen('php://temp', 'w+');
curl_setopt($ch, CURLOPT_STDERR, $verbose_curl_output);
$curlConfig[CURLOPT_VERBOSE] = true;
$curlConfig[CURLOPT_STDERR] = $verbose_curl_output;
}
curl_setopt_array($ch, $curlConfig);
......@@ -199,10 +198,13 @@ class Request
self::setInputRaw($result);
}
$curl_error = curl_error($ch);
$curl_errno = curl_errno($ch);
curl_close($ch);
if ($result === false) {
throw new TelegramException(curl_error($ch), curl_errno($ch));
throw new TelegramException($curl_error, $curl_errno);
}
if (empty($result) | is_null($result)) {
throw new TelegramException('Empty server response');
......
......@@ -136,10 +136,7 @@ class TelegramLog
*/
public static function isErrorLogActive()
{
if (self::$error_log_path === null) {
return 0;
}
return 1;
return (self::$error_log_path !== null);
}
/**
......@@ -149,10 +146,7 @@ class TelegramLog
*/
public static function isDebugLogActive()
{
if (self::$debug_log_path === null) {
return 0;
}
return 1;
return (self::$debug_log_path !== null);
}
/**
......@@ -162,10 +156,7 @@ class TelegramLog
*/
public static function isUpdateLogActive()
{
if (self::$update_log_path === null) {
return 0;
}
return 1;
return (self::$update_log_path !== null);
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment