Sets logging for bussiness-logic level messages.

@param string|callback $log String filename or callback that forwards
messages to your own logging system.

@return Client
499133
function setLog($log) {
		if (!$log) {
			$this->logFile = null;
			$this->logCallback = null;
		} elseif (is_callable($log)) {
			$this->logFile = null;
			$this->logCallback = $log;
		} else {
			Files::create($log);
			$this->logFile = $log;
			$this->logCallback = null;
		}
		return $this;
	}
1052260
public function debugLog($log)
    {
        if (defined('DEBUG_MODE') and DEBUG_MODE == 1) {
            $log = 'DEBUG >>> ' . $log;
            echo $log . PHP_EOL . PHP_EOL;
        }

        return $this;
    }
1168651
public function getLog(): ?Log
    {
        if (!$this->hasLog()) {
            $this->setLog($this->getDefaultLog());
        }
        return $this->log;
    }
759346
protected function createLoggable($log_file, array $guzzle_options = [])
    {
        $writer = new \Monolog\Handler\StreamHandler($log_file);
        $writer->setFormatter(new \Monolog\Formatter\LineFormatter(null, null, true));
        $logger = new \Monolog\Logger('korchasa\Telegram');
        $logger->pushHandler($writer);

        $handler = \GuzzleHttp\HandlerStack::create();
        $handler->push(\GuzzleHttp\Middleware::log(
            $logger,
            new \GuzzleHttp\MessageFormatter(\GuzzleHttp\MessageFormatter::DEBUG)
        ));

        return new Client(array_merge(array(
            'handler' => $handler,
            'http_errors' => false,
        ), $guzzle_options));
    }
760941
public function update( LogDataInterface $log ) {

		if ( ! did_action( Controller::ACTION_LOADED ) || $log->level() < 1 ) {
			return FALSE;
		}

		try {

			return $this->channels
				->logger( $log->channel() )
				->addRecord( $log->level(), $log->message(), $log->context() );

		} catch ( \Throwable $e ) {
			/**
			 * Fires when the logger encounters an error.
			 *
			 * @param LogDataInterface      $log
			 * @param \Exception|\Throwable $e
			 */
			do_action( self::ACTION_LOGGER_ERROR, $log, $e );

			return FALSE;
		} catch ( \Exception $e ) {
			/** This action is documented in src/LogActionSubscriber.php */
			do_action( self::ACTION_LOGGER_ERROR, $log, $e );

			return FALSE;
		}
	}
9933
public function log(array $log)
    {
        if ($this->loggerCallable) {
            call_user_func($this->loggerCallable, array_merge($this->logDefault, $log));
        }
    }
785155
public function setLogFile($logFile)
    {
        if (strpos($logFile, '://') === false) {
            if (!GeneralUtility::isAbsPath($logFile)) {
                $logFile = PATH_site . $logFile;
            }
        }

        $this->logFile = $logFile;
        $this->openLogFile();

        return $this;
    }
1035844
public function logger($instance = null)
    {
        deprecationWarning(
            'Connection::logger() is deprecated. ' .
            'Use Connection::setLogger()/getLogger() instead.'
        );
        if ($instance === null) {
            return $this->getLogger();
        }

        $this->setLogger($instance);
    }
754139
public static function setDefaultLog( $defaultLog )
    {
        if ( null === $defaultLog )
        {
            static::$_defaultLog = null;

            return;
        }

        //	Set up a new log file...
        static::$_logger = null;
        \Kisma::set( 'app.log_file_path', static::$_logFilePath = dirname( $defaultLog ) );
        \Kisma::set( 'app.log_file_name', static::$_logFileName = basename( $defaultLog ) );

        static::_checkLogFile();
    }
838093
private function writeLog($log)
    {
        $fh = fopen($this->_filepath, 'a');

        fwrite($fh, $log);
        fclose($fh);
    }
327235
public function append($log)
    {
        if ($this->_lazy) {
            $context = $this->_context;

            $context->logs[] = $this->_format($log);
        } else {
            $this->_write($this->_format($log));
        }
    }
393016
protected function log(/*# string */ $level, /*# string */ $message)
    {
        if ($this->debug_mode) {
            $this->debugger->log(
                $level,
                $message,
                [ 'className' => get_class($this) ]
            );
        }
        return $this;
    }
334808
public function setLogger(
        \Psr\Log\LoggerInterface $logger = null,
        $messageFormat = \GuzzleHttp\MessageFormatter::CLF
    ) {
        if ($logger === null) {
            $handler = new \Monolog\Handler\ErrorLogHandler(\Monolog\Handler\ErrorLogHandler::SAPI);
            $handler->setFormatter(new \Monolog\Formatter\LineFormatter('%message%'));
            $logger = new \Monolog\Logger('HTTP Log', [$handler]);
        }

        $formatter = new \GuzzleHttp\MessageFormatter($messageFormat);

        $handler = \GuzzleHttp\Middleware::log($logger, $formatter);
        $this->logger = $handler;

        $handlerStack = $this->getConfig('handler');
        $this->setLogHandler($handlerStack, $handler);

        return $this;
    }
181749
public function setLogLocation($location = false) {
        if($location === false) {
            $location = dirname(__FILE__).DIRECTORY_SEPARATOR.'logs'.DIRECTORY_SEPARATOR;
        }
        $this->logLocation = $location;
        if (!file_exists($location)) {
            mkdir($location, 0777, true);
        }
        return $this;
    }
952899
public function log($log)
    {
        $type = $log->type();
        if (!isset($this->_logs[$type])) {
            $this->_logs[$type] = [];
        }
        $this->_logs[$type][] = $log;
        return $this;
    }
1313353
public function addLog(Log $log)
    {
        $log->setInstance($this);
        $this->getLogs()->add($log);
    }
201276
public void setLog( Log log )
    {
        this.mavenLogger = log;
        
        //Match the log level of the Java logger with that set in the Maven logger 
        if ( log.isDebugEnabled() ) 
        {
            javaLogger.setLevel( Level.FINE );
        } 
        else if ( log.isInfoEnabled() ) 
        {
            javaLogger.setLevel( Level.INFO );
        } 
        else if ( log.isWarnEnabled() ) 
        {
            javaLogger.setLevel( Level.WARNING );
        } 
        else 
        {
            javaLogger.setLevel( Level.SEVERE );
        }
    }