tawfiq-alqaidy/logpilot-laravel 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tawfiq-alqaidy/logpilot-laravel

Composer 安装命令:

composer require tawfiq-alqaidy/logpilot-laravel

包简介

Zero-configuration SDK that captures unhandled exceptions and logs them to LogPilot AI

README 文档

README

A lightweight, zero-configuration Laravel package that automatically captures unhandled exceptions and sends them to LogPilot AI via a FastAPI microservice.

No changes to config/logging.php or your exception handler are required — install the package, set your API URL, and you're done.

Requirements

  • PHP ^8.1
  • Laravel 10 or 11

Installation

Install via Composer:

composer require tawfiq-alqaidy/logpilot-laravel

The service provider is auto-discovered. No manual registration is needed.

Configuration

Environment variables

Add these to your .env file:

LOGPILOT_API_URL=http://localhost:8000/api/v1/logs
LOGPILOT_SERVICE_NAME="${APP_NAME}"
Variable Description Default
LOGPILOT_API_URL LogPilot FastAPI ingest endpoint http://localhost:8000/api/v1/logs
LOGPILOT_SERVICE_NAME Identifier for this service in LogPilot Value of APP_NAME, or laravel-app

Publish config (optional)

To customize the config file directly:

php artisan vendor:publish --tag=logpilot-config

This publishes config/logpilot.php to your application.

How it works

On boot, the package:

  1. Registers a custom logpilot Monolog channel.
  2. Appends logpilot to Laravel's default stack channel (when LOG_CHANNEL=stack, the Laravel default).

When Laravel's exception handler logs an unhandled exception to the stack, the LogPilotHandler intercepts it and sends a fire-and-forget HTTP POST to your LogPilot API:

{
  "service_name": "my-laravel-app",
  "error_type": "RuntimeException",
  "stack_trace": "..."
}

If LogPilot is unreachable or returns an error, the failure is silently ignored — your Laravel app is never affected.

Manual logging

You can also send logs directly to the LogPilot channel:

use Illuminate\Support\Facades\Log;

Log::channel('logpilot')->error('Something went wrong', [
    'exception' => $exception,
]);

When an exception is present in the log context, the handler extracts the exception class and stack trace automatically. Otherwise, the log message is used for both fields.

Architecture

Exception Handler
       │
       ▼
  stack channel  ──►  logpilot channel  ──►  LogPilotHandler  ──►  POST /api/v1/logs

License

MIT

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固