dmitry.g.ivanov
3 years ago

Console command logger (with email notifications)

Posted 3 years ago by dmitry.g.ivanov

Hi there!

Just wanted to write few words about a package I've just released:

https://github.com/dmitry-ivanov/laravel-console-logger

https://packagist.org/packages/illuminated/console-logger

Often I'm working with a projects, which have a lot of scheduled commands (cron jobs). These crons can be very simple - just make some trivial operations with database, generate some report, etc... But also, they can be really complex - some interaction with external services, getting data from them, pushing data to them, etc.

So, it's very useful for me to have some kind or text logs (separate logs for each command) and, which is even more important, some kind of monitoring tool, which would notify me if something went wrong.

This is exactly what illuminated/console-logger package do.

After installing package through composer, all you have to do is use additional trait in your command class and specify notification recipients. Package is fully customizable and has a lot of cool features, such as: logs separated by commands and dates, auto-rotation (only latest 30 files are stored), global error handler (it would catch ALL types of possible errors - even PHP notices for you), email notifications with optional deduplication if needed, ability to save notifications to database, set of useful info added to your logs, context support with nice dumps, etc....

I've tried to describe all of these features really good in readme, there are a lot of examples, and even notification screenshot example. So, please, check it for more information. Feel free to ask me if you would have some questions about the package.

Hope it would be useful for someone. Thanks!

Please sign in or create an account to participate in this conversation.