2017 © Pedro Peláez
 

library laravel-email-logger

Simple Laravel package for logging via mail

image

salvakexx/laravel-email-logger

Simple Laravel package for logging via mail

  • Monday, March 26, 2018
  • by salvakexx
  • Repository
  • 1 Watchers
  • 0 Stars
  • 117 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 38 % Grown

The README.md

laravel-email-logger

Simple Laravel package for logging via email, (*1)

Installation

Add the package using composer:, (*2)

composer require salvakexx/laravel-email-logger

In your config/app.php :, (*3)

'providers' => [
  /*
   * Package Service Providers...
   */
   Salvakexx\EmailLogger\EmailLoggerServiceProvider::class,
],
'aliases' => [
  /*
   * Class Aliases...
   */
   'EmailLogger' => \Salvakexx\EmailLogger\EmailLoggerFacade::class,
],

Publish the configuration file, (*4)

php artisan vendor:publish --provider="Salvakexx\EmailLogger\EmailLoggerServiceProvider"

Quickstart

  1. Fill emails (and other parameters) in app/config/email-logger.php
    'emails' => [
        //fill this array with emails that will receive logs
    ],
//    'emails'    => explode(',',env('MAIL_LOGGER_EMAILS')),
  1. Check out your email configuration. Mail Facade must be working

Using

  \EmailLogger::info(request(),'Information on action etc. ');

  \EmailLogger::error($exception,request(),'Error happened please check');

You can catch every exception directly, or catch all exceptions on your website. To do this override render() function in app/Exceptions/Handler.php for example :, (*5)



/** * Render an exception into an HTTP response. * * @param \Illuminate\Http\Request $request * @param \Exception $exception * @return \Illuminate\Http\Response */ public function render($request, Exception $exception) { //exclude the common exceptions $exception = $this->prepareException($exception); if( !$exception instanceof NotFoundHttpException && !$exception instanceof AuthenticationException && !$exception instanceof ValidationException ){ \EmailLogger::error($exception,$request,'Internal Server Error happened'); } //Track user camed to 404 if($exception instanceof NotFoundHttpException){ \EmailLogger::info($request,'User lost somehow check please'); } return parent::render($request, $exception); }

The Versions

26/03 2018

dev-master

9999999-dev

Simple Laravel package for logging via mail

  Sources   Download

MIT

The Requires

 

by Dmytro Tymoshenko

26/03 2018

0.0.4

0.0.4.0

Simple Laravel package for logging via mail

  Sources   Download

MIT

The Requires

 

by Dmytro Tymoshenko

23/03 2018

0.0.3

0.0.3.0

Simple Laravel package for logging via mail

  Sources   Download

MIT

The Requires

 

by Dmytro Tymoshenko

23/03 2018

0.0.2

0.0.2.0

Simple Laravel package for logging via mail

  Sources   Download

MIT

The Requires

 

by Dmytro Tymoshenko