logtide/logtide-laravel
最新稳定版本:v0.7.4
Composer 安装命令:
composer require logtide/logtide-laravel
包简介
Laravel integration for the LogTide PHP SDK
README 文档
README
logtide/logtide-laravel
LogTide integration for Laravel - automatic request tracing, error capture, and breadcrumbs.
Features
- Automatic request tracing via HTTP middleware
- Error capture with full request context
- W3C Trace Context propagation (
traceparentin/out) - Laravel Log Channel - use LogTide as a logging driver
- Facade -
Logtide::info(...)static access - Breadcrumb integrations - DB queries, cache operations, queue jobs
- Auto-discovery - zero configuration needed
- Laravel 10, 11, and 12 support
Installation
composer require logtide/logtide-laravel
The service provider is auto-discovered. No manual registration needed.
Quick Start
- Add your DSN to
.env:
LOGTIDE_DSN=https://lp_your_key@your-logtide-instance.com
- Optionally publish the config:
php artisan vendor:publish --tag=logtide-config
That's it! HTTP requests are automatically traced, exceptions captured, and DB queries recorded as breadcrumbs.
Configuration
// config/logtide.php return [ 'dsn' => env('LOGTIDE_DSN'), 'service' => env('LOGTIDE_SERVICE', env('APP_NAME', 'laravel')), 'environment' => env('LOGTIDE_ENVIRONMENT', env('APP_ENV', 'production')), 'release' => env('LOGTIDE_RELEASE'), 'batch_size' => (int) env('LOGTIDE_BATCH_SIZE', 100), 'flush_interval' => (int) env('LOGTIDE_FLUSH_INTERVAL', 5000), 'max_buffer_size' => (int) env('LOGTIDE_MAX_BUFFER_SIZE', 10000), 'max_retries' => (int) env('LOGTIDE_MAX_RETRIES', 3), 'traces_sample_rate' => (float) env('LOGTIDE_TRACES_SAMPLE_RATE', 1.0), 'debug' => (bool) env('LOGTIDE_DEBUG', false), 'send_default_pii' => (bool) env('LOGTIDE_SEND_DEFAULT_PII', false), 'breadcrumbs' => [ 'db_queries' => true, 'cache' => true, 'queue' => true, 'http_client' => true, ], 'skip_paths' => ['/health', '/healthz'], ];
Using the Log Channel
Add LogTide as a logging channel in config/logging.php:
'channels' => [ 'logtide' => [ 'driver' => 'custom', 'via' => \LogTide\Laravel\LogChannel::class, 'level' => 'debug', ], ],
Then use it:
Log::channel('logtide')->info('Hello from Laravel!'); // Or set as default in .env: // LOG_CHANNEL=logtide
Using the Facade
use LogTide\Laravel\LogtideFacade as Logtide; Logtide::info('User logged in', ['user_id' => 123]); Logtide::captureException($exception);
Breadcrumb Integrations
All enabled by default in config/logtide.php:
- DB Queries - records SQL queries as breadcrumbs (via
QueryBreadcrumbIntegration) - Cache - records cache hits, misses, writes (via
CacheBreadcrumbIntegration) - Queue - records job processing events (via
QueueIntegration)
License
MIT License - see LICENSE for details.
Links
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-03-06
