Postuf / telegram-osint-lib

Telegram scenario-based API aimed at OSINT
https://habr.com/ru/post/486322
MIT License
255 stars 41 forks source link

Question about logging #198

Closed DKanarsky closed 4 years ago

DKanarsky commented 4 years ago

How to disable logging in console using docker? Thanks!

Qusonann commented 4 years ago

If you use examples "as is", there's no way to disable it using command line args. However, you can fix this applying this patch:

diff --git a/src/Scenario/ClientGenerator.php b/src/Scenario/ClientGenerator.php
index cfd528e..51ed422 100644
--- a/src/Scenario/ClientGenerator.php
+++ b/src/Scenario/ClientGenerator.php
@@ -11,6 +11,7 @@ use TelegramOSINT\Exception\TGException;
 use TelegramOSINT\LibConfig;
 use TelegramOSINT\Logger\ClientDebugLogger;
 use TelegramOSINT\Logger\DefaultLogger;
+use TelegramOSINT\Logger\NullLogger;
 use TelegramOSINT\Tools\Proxy;

 class ClientGenerator implements ClientGeneratorInterface
@@ -26,7 +27,7 @@ class ClientGenerator implements ClientGeneratorInterface
     {
         $this->envName = $envName;
         $this->proxy = $proxy;
-        $this->logger = $logger ?? new DefaultLogger();
+        $this->logger = $logger ?? new NullLogger();
     }

     public function getInfoClient(): InfoClient

This disables logging by default.