🪟 Windows TippsThe Gemini desktop app is now available for Windows(11.09.2026 um 17:06 Uhr)
🪟 Windows TippsSetting up live captions stuck in Windows 11(14.09.2026 um 16:31 Uhr)
🕵️ SicherheitslückenBurn Out, Or Fade Away(14.09.2026 um 14:25 Uhr)
🪟 Windows TippsWindows 11's latest update broke my speakers, and I'm not alone(14.09.2026 um 18:54 Uhr)
🪟 Windows TippsThe Gemini desktop app is now available for Windows(11.09.2026 um 17:06 Uhr)
🪟 Windows TippsSetting up live captions stuck in Windows 11(14.09.2026 um 16:31 Uhr)
🕵️ SicherheitslückenBurn Out, Or Fade Away(14.09.2026 um 14:25 Uhr)
🪟 Windows TippsWindows 11's latest update broke my speakers, and I'm not alone(14.09.2026 um 18:54 Uhr)

🔧 Programmierung 🕛 vor 1 Jahr 3 Min Lesezeit
0

Sending logs to Telegram. Module for Laravel

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht

Hello everyone! In this post, I would like to share with you a module that I have developed for Laravel.



https://github.com/prog-time/tg-logger



This is my first experience in developing public modules for Laravel, so please do not judge strictly!



This module allows you to easily and quickly set up the sending of logs and error messages to the Telegram community, where you can select a separate topic for each type of event. This way you can send messages about custom events, exceptions, and system errors.



Of course, there are more advanced logging solutions, but they require deeper configuration. I wanted to create a module that would be quick to set up and well suited for small and medium-sized projects.






Configuring the module



First, you need to create a Telegram bot that will be responsible for sending notifications. After that, we create a group, enable "Themes" in it and add the created bot to the group (necessarily with administrator rights).



After creating the bot, we write the bot token and the group id to the .env file.




CODE
TG_LOGGER_TOKEN="token_bot"
TG_LOGGER_CHAT_ID="id_group"






We install the module via Composer.




CODE
composer require prog-time/tg-logger






After installing the module, you need to create a configuration file. config/tg-logger.php and write in it the parameters for the operation of the module.



You can create the file manually or transfer the prepared version of the configuration, which is located inside the module, using the following command.




CODE
php artisan vendor:publish --tag=config






Now let's fill in the created configuration file.




CODE
return [
'token' => env('TG_LOGGER_TOKEN'),
'chat_id' => env('TG_LOGGER_CHAT_ID'),
'topics' => [
[
'name' => 'Debug messages',
'icon_color' => '9367192',
'level' => 'debug',
],
[
'name' => 'Cron tasks',
'icon_color' => '9367192',
'level' => 'crone',
],
[
'name' => 'Errors',
'icon_color' => '9367192',
'level' => 'error, notice, warning, emergency',
]
]
];






Configuration tg-logger.php It includes the following parameters:




  • token — a Telegram bot token

  • chat_id is the ID of the group where we will send logs to

  • topics — here we specify the names of the topics, the types of logs that the theme will accept, and the colors of the theme icons.



After setting up tg-logger.php you need to run the command that will create the topics in the group.




CODE
php artisan tglogger:create-topics






*After running this command, the file tg-logger.php it will be overwritten and the topic IDs will be specified in it.



This completes the configuration of the module, below we will look at how to work with the TgLogger module.






Working with the TgLogger module






Catching system errors



To catch all types of errors, you need to change the basic log handler in the configuration file. config/logging.php by specifying the module classes as handlers.




CODE
'channels' => [
...
'telegram' => [
'driver' => 'monolog',
'handler' => ProgTime\TgLogger\TgHandler::class,
'formatter' => ProgTime\TgLogger\TgFormatter::class,
'level' => 'debug',
],
...
],






And in .env, change the LOG_CHANNEL parameter.




CODE
LOG_CHANNEL=telegram









Sending messages via the TgLogger class



You can also send alerts directly using the TgLogger class and the static sendLog() method.




CODE
TgLogger::sendLog('Your message', 'level');






Many thanks to those who read this article to the end! I will be very glad if you support this decision on GitHub and write your comment under this post.

Vollständiger Original-Bericht
Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 0%
🟡 In Evaluierung 0%
🟢 Keine Auswirkung 0%
Spannende Innovation 0%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
1 Quelle
The Gemini desktop app is now available for Windows
1 Quelle
Setting up live captions stuck in Windows 11
1 Quelle
Burn Out, Or Fade Away
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Sending logs to Telegram. Module for Laravel

Thematisch verwandte Begriffe: Sending, logs, Telegram, Module · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...