@@ -38,6 +38,14 @@ Open config/logging.php and change the file
3838 'topic_id' => env('LOG_TELEGRAM_TOPIC_ID',null),
3939 'bot_api' => env('LOG_TELEGRAM_BOT_API', 'https://api.telegram.org/bot'),
4040 'proxy' => env('LOG_TELEGRAM_BOT_PROXY', null),
41+ 'topics_level' => [
42+ \TheCoder\MonologTelegram\Attributes\EmergencyAttribute::class => env('LOG_TELEGRAM_EMERGENCY_ATTRIBUTE_TOPIC_ID', null),
43+ \TheCoder\MonologTelegram\Attributes\CriticalAttribute::class => env('LOG_TELEGRAM_CRITICAL_ATTRIBUTE_TOPIC_ID', null),
44+ \TheCoder\MonologTelegram\Attributes\ImportantAttribute::class => env('LOG_TELEGRAM_IMPORTANT_ATTRIBUTE_TOPIC_ID', null),
45+ \TheCoder\MonologTelegram\Attributes\DebugAttribute::class => env('LOG_TELEGRAM_DEBUG_ATTRIBUTE_TOPIC_ID', null),
46+ \TheCoder\MonologTelegram\Attributes\InformationAttribute::class => env('LOG_TELEGRAM_INFORMATION_ATTRIBUTE_TOPIC_ID', null),
47+ \TheCoder\MonologTelegram\Attributes\LowPriorityAttribute::class => env('LOG_TELEGRAM_LOWPRIORITY_ATTRIBUTE_TOPIC_ID', null),
48+ ]
4149 ],
4250
4351 'formatter' => TheCoder\MonologTelegram\TelegramFormatter::class,
@@ -49,6 +57,31 @@ Open config/logging.php and change the file
4957
5058```
5159
60+ With topics_level you can set PHP Attribute(Annotation) to controller function
61+
62+ and change the topic id base on this attributes
63+
64+ Note: this package will only process first attribute
65+
66+ Example:
67+
68+ ``` php
69+ namespace App\Http\Controllers\NewWeb;
70+
71+ use App\Http\Controllers\Controller;
72+ use Illuminate\Http\Request;
73+ use TheCoder\MonologTelegram\Attributes\EmergencyAttribute;
74+
75+ class HomeController extends Controller
76+ {
77+ #[EmergencyAttribute]
78+ public function index(Request $request)
79+ {
80+ //
81+ }
82+ }
83+ ```
84+
5285You can customize token, chat_id and topic_id in run time
5386
5487``` php
0 commit comments