laravel-cloud-logging maintained by nmc
Description
Google Cloud Logging For Laravel
Author
Last update
2026/07/28 14:32
(dev-main)
License
Downloads
7 379
Tags
Google Cloud Logging For Laravel
Installation
You can install the package via composer:
composer require nmc/laravel-cloud-logging
You can publish the config file with:
php artisan vendor:publish --provider="Nmc\CloudLogging\CloudLoggingServiceProvider" --tag="cloud-logging-config"
This is the contents of the published config file:
return [
'enable_error_reporting' => env('CLOUD_LOGGING_ENABLE_ERROR_REPORTING', isset($_SERVER['GAE_SERVICE']) ?? false),
'logger' => [
'driver' => 'stackdriver',
'level' => env('LOG_LEVEL', 'debug'),
'name' => env('CLOUD_LOGGING_NAME', 'laravel-cloud-logging'),
'project' => env('CLOUD_LOGGING_PROJECT_ID'),
'credentials' => env('CLOUD_LOGGING_CREDENTIALS', config_path('stackdriver.json')),
],
];
Edit app/Exceptions/Handler.php
use Nmc\CloudLogging\CloudErrorReporting;
public function register(): void
{
$this->reportable(function (Throwable $e) {
if (CloudErrorReporting::isEnabled()) {
CloudErrorReporting::report($e);
}
});
}
Usage
use Illuminate\Support\Facades\Log;
Log::channel('stackdriver')->info('Test');
License
The MIT License (MIT). Please see License File for more information.