2017 © Pedro Peláez
 

library laravel-stack-driver-logger

image

pagevamp/laravel-stack-driver-logger

  • Tuesday, March 27, 2018
  • by developernaren
  • Repository
  • 1 Watchers
  • 1 Stars
  • 2,400 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 102 % Grown

The README.md

Laravel Stack Driver Logger

Google Cloud Stack Driver error monitoring integration for Laravel projects. This library adds a listener to Laravel's logging component. Laravel's session information will be sent in to Stack Driver, as well as some other helpful information such as 'environment', 'server', and 'session'., (*1)

Installation

Install using composer:, (*2)

composer require pagevamp/laravel-stack-driver-logger

Add the service provider to the 'providers' array in config/app.php:, (*3)

Pagevamp\Providers\StackDriverLoggerServiceProvider::class,

If you only want to enable Stack Driver reporting for certain environments you can conditionally load the service provider in your AppServiceProvider:, (*4)

    public function register()
    {
        if ($this->app->environment('production')) {
            $this->app->register(\Pagevamp\Providers\StackDriverLoggerServiceProvider::class);
        }
    }

Configuration

This package supports configuration through the services configuration file located in config/services.php. All configuration variables will be directly passed to Stack Driver:, (*5)

'stack_driver_logger' => [
    'credentials' => [
        'keyFile' => json_decode(trim(env('GC_LOG_SERVICE_CRED'), "'"), 1),
    ],
    'log_name' => env('GC_LOG_NAME', 'builder-log'),
],

Usage

To automatically monitor exceptions, simply use the Log facade in your error handler in app/Exceptions/Handler.php:, (*6)

public function report(Exception $exception)
{
    \Log::error($exception); //Stack Driver
    parent::report($exception);
}

Your other log messages will also be sent to Stack Driver:, (*7)

\Log::debug('Here is some debug information');

NOTE: Fatal exceptions will always be sent to Stack Driver., (*8)

Context informaton

You can pass user information as context like this:, (*9)

\Log::error('Something went wrong', [
    'person' => ['id' => 123, 'username' => 'John Doe', 'email' => 'john@doe.com']
]);

Or pass some extra information:, (*10)

\Log::warning('Something went wrong', [
    'download_size' => 3432425235
]);

The Versions

27/03 2018

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

 

by Sajjan

27/03 2018

v1.0.3

1.0.3.0

  Sources   Download

MIT

The Requires

 

by Sajjan

26/03 2018

v1.0.2

1.0.2.0

  Sources   Download

MIT

The Requires

 

by Sajjan

26/03 2018

v1.0.1

1.0.1.0

  Sources   Download

MIT

The Requires

 

by Sajjan

26/03 2018

v1.0.0

1.0.0.0

  Sources   Download

MIT

The Requires

 

by Sajjan

23/03 2018

0.0.1

0.0.1.0

  Sources   Download

MIT

The Requires

 

by Sajjan