diff --git a/.idea/php.xml b/.idea/php.xml
index f029d2f..5b053b9 100644
--- a/.idea/php.xml
+++ b/.idea/php.xml
@@ -12,9 +12,8 @@
-
+
-
diff --git a/src/TgBotLib/Bot.php b/src/TgBotLib/Bot.php
index f4ecb15..206f86d 100644
--- a/src/TgBotLib/Bot.php
+++ b/src/TgBotLib/Bot.php
@@ -10,9 +10,9 @@
namespace TgBotLib;
use InvalidArgumentException;
- use LogLib\Log;
use ReflectionClass;
use TgBotLib\Abstracts\Method;
+ use TgBotLib\Classes\Logger;
use TgBotLib\Enums\Methods;
use TgBotLib\Enums\Types\ChatActionType;
use TgBotLib\Enums\Types\ParseMode;
@@ -50,6 +50,7 @@
/**
* @method Update[] getUpdates(?int $offset=null, ?int $limit=null, ?int $timeout=null, ?string $allowed_updates=null) Use this method to receive incoming updates using long polling (wiki). An Array of Update objects is returned.
+ * @method bool setWebhook(string $url, ?string $certificate=null, ?string $ip_address=null, ?int $max_connections=null, ?string $allowed_updates=null, ?bool $drop_pending_updates=null, ?string $secret_token=null) Use this method to specify a url and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified url, containing a JSON-serialized Update. In case of an unsuccessful request, we will give up after a reasonable amount of attempts. Returns True on success.
* @method User getMe() A simple method for testing your bot's authentication token. Requires no parameters. Returns basic information about the bot in form of a User object.
* @method bool logOut() Use this method to log out from the cloud Bot API server before launching the bot locally. You must log out the bot before running it locally, otherwise there is no guarantee that the bot will receive updates. After a successful call, you can immediately log in on a local server, but will not be able to log in back to the cloud Bot API server for 10 minutes. Returns True on success. Requires no parameters.
* @method bool close() Use this method to close the bot instance before moving it from one local server to another. You need to delete the webhook before calling this method to ensure that the bot isn't launched again after server restart. The method will return error 429 in the first 10 minutes after the bot is launched. Returns True on success. Requires no parameters.
@@ -242,6 +243,7 @@
try
{
+ Logger::getLogger()->debug(sprintf('Executing method %s with parameters %s', $method->value, json_encode($parameters)));
return $method->execute($this, $parameters);
}
catch(TelegramException $e)
@@ -257,7 +259,7 @@
$waitTime = 5;
}
- Log::warning('net.nosial.tgbotlib', "Too Many Requests error, retrying in {$waitTime} seconds");
+ Logger::getLogger()->verbose(sprintf('Too many requests, waiting %d seconds before retrying', $waitTime));
sleep($waitTime);
return $method->execute($this, $parameters);
diff --git a/src/TgBotLib/Classes/Logger.php b/src/TgBotLib/Classes/Logger.php
new file mode 100644
index 0000000..e4adf6c
--- /dev/null
+++ b/src/TgBotLib/Classes/Logger.php
@@ -0,0 +1,28 @@
+