Cherry-Pie / LogEnvelope by Cherry Pie

Laravel 5 email on error
45,578
41
4
Package Data
Maintainer Username: Cherry Pie
Maintainer Contact: 12fcv4@gmail.com (Yaro)
Package Create Date: 2015-08-02
Package Last Update: 2024-02-27
Home Page:
Language: PHP
License: MIT
Last Refreshed: 2024-11-19 03:14:51
Package Statistics
Total Downloads: 45,578
Monthly Downloads: 500
Daily Downloads: 14
Total Stars: 41
Total Watchers: 4
Total Forks: 11
Total Open Issues: 3

Log Envelope

Laravel 5 package for logging errors to your e-mail(s), telegram, slack and database!

Scrutinizer Code Quality Build Status Total Downloads

Installation

You can install the package through Composer.

composer require yaro/log-envelope

You must install this service provider. Make this the very first provider in list.

// config/app.php
'providers' => [
    // make this very first provider
    // so fatal exceptions can be catchable by envelope
    Yaro\LogEnvelope\ServiceProvider::class,
    //...
];

Then publish the config and migration file of the package using artisan.

php artisan vendor:publish --provider="Yaro\LogEnvelope\ServiceProvider"

Change your Exception Handler's (/app/Exceptions/Handler.php by default) report method like this:

//...
public function report(Exception $e)
{
    $res = parent::report($e);
    
    \LogEnvelope::send($e);
    //...
    
    return $res; 
}
//...

Change config yaro.log-envelope.php for your needs. You can choose to log your errors to your database or send them to your email/telegram/slack. Emails are preferable, cuz they contains more debug information, such as traceback.

There is a censored_fields option which will change any fields value to ***** if it is named in this array. For example by default it will change values for fields called password to *****.

Also there is force_config option, where you can define which configs to override for LogEnvelope execution. E.g., if you using some smtp for mail sending and queue it, you can change configs to send LogEnvelope emails immediately and not via smtp:

'force_config' => [
    'mail.driver' => 'sendmail',
    'queue.default' => 'sync',
],

TODO

  • highlight traceback in emails
  • page with logs from database

Results

Something like this with other info for debugging.


Email:

results


Slack:

results


Telegram:

results

License

The MIT License (MIT). Please see LICENSE for more information.