khairulimran/laravel-log-central
Composer 安装命令:
composer require khairulimran/laravel-log-central
包简介
Ship logs and exceptions from a Laravel app to a Log Central server.
README 文档
README
Ship logs and exceptions from any Laravel app to your self-hosted Log Central server — zero code changes, three env values.
- Exceptions, automatically — every reported exception (web, queue, artisan, scheduler,
report($e)) is captured and shipped with fingerprint, stack trace, request info, and the authenticated user. - Log channels, wrapped — pick channels (or
*for all) and their entries stream to the central log viewer while local files keep working as backup. - Never blocks your app — everything ships through queued jobs, batched, with capped retries. Shipping failures are silent and can never loop.
- Scrubbed before sending — passwords, tokens, keys, and card numbers are replaced with
[scrubbed]before leaving the app.
Requirements
- PHP 8.2+, Laravel 11–13
- A running queue worker (Redis/Horizon recommended)
- A Log Central server and a project key (Apps page)
Installation
composer require khairulimran/laravel-log-central
Add to .env:
CENTRAL_LOG_URL=https://logs.example.com/api CENTRAL_LOG_TOKEN=your-project-key CENTRAL_LOG_APP=your-app-slug # comma-separated list, or * to ship every channel CENTRAL_LOG_CHANNELS=payment_callback,webhook
That's it. The service provider auto-registers, hooks exception reporting, and wraps the listed channels.
Configuration
Publish the config to customise scrub keys, the shipping queue, or defaults:
php artisan vendor:publish --tag=log-central-config
| Env | Default | Purpose |
|---|---|---|
CENTRAL_LOG_URL |
— | Base API URL of the Log Central server |
CENTRAL_LOG_TOKEN |
— | The app's project key |
CENTRAL_LOG_APP |
slug of app.name |
Must match the slug registered on Log Central |
CENTRAL_LOG_CHANNELS |
(empty) | Channels to ship; * = all (exceptions ship regardless) |
CENTRAL_LOG_QUEUE |
default queue | Queue name for shipping jobs |
CENTRAL_LOG_ENABLED |
true |
Master switch (set false in testing) |
What gets captured
| Situation | Shipped? |
|---|---|
| Uncaught exception (web, queue, artisan, scheduler) | ✅ as error |
report($e) inside try/catch |
✅ as error |
Log::...() on a shipped channel |
✅ as log entry |
Log::...() on an unlisted channel |
❌ file only |
Exception silently swallowed without report() |
❌ |
Testing
composer install
composer test
License
MIT
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-07-12