]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Исправление работы логов из файла
authorfomichev <vladimir.fomichev@erp-flowers.ru>
Fri, 1 Nov 2024 10:58:35 +0000 (13:58 +0300)
committerfomichev <vladimir.fomichev@erp-flowers.ru>
Fri, 1 Nov 2024 10:58:35 +0000 (13:58 +0300)
erp24/log/TelegramTarget.php
erp24/services/TelegramService.php

index 044247c4467a13707b2fb93ad51978cfe424e35d..ebe4efb28b1561fff3488d68c62683dc102b18a1 100644 (file)
@@ -130,7 +130,7 @@ class TelegramTarget extends \yii\log\Target
         ];
 
         $formattedMessage = implode("\n", $text);
-
+        $formattedMessage = TelegramService::escapeMarkdown($formattedMessage);
         // Настройка уведомления для сообщений уровня ERROR
         $disableNotification = $message->message[1] !== Logger::LEVEL_ERROR;
 
index fc79c4c77c493eeffbbba3e9df4a9fac1d13c2a9..2f90557305ded254335526a100e1ca06f09bd783 100644 (file)
@@ -25,7 +25,7 @@ public static function sendErrorToTelegramMessage($message,$disableNotification)
     $botToken = self::TELEGRAM_API_URL;
     $chatId = self::CHAT_CHANNEL_ID;
     $apiURL = "https://api.telegram.org/bot{$botToken}/sendMessage";
-    //$message = self::escapeMarkdown($message);
+
     $client = new Client();
     try {
         $client->post($apiURL, [
@@ -43,7 +43,7 @@ public static function sendErrorToTelegramMessage($message,$disableNotification)
 
 
     // Метод для экранирования символов MarkdownV2
-    private static function escapeMarkdown($text)
+    public static function escapeMarkdown($text)
     {
         // Экранирование символов, зарезервированных в MarkdownV2
         $specialChars = ['_', '*', '[', ']', '(', ')', '~', '`', '>', '#', '+', '-', '=', '|', '{', '}', '.', '!'];