fragly / laravel-extended-logger
Advanced Laravel logger with database, Discord, Telegram, and Slack support.
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/fragly/laravel-extended-logger
Requires
- php: >=8.2
- guzzlehttp/guzzle: ^7.10
- illuminate/database: ^12.35
- illuminate/support: ^12.35
- monolog/monolog: ^3.9
README
Compare and safely synchronize your
.envwith.env.example.
Perfect for CI/CD pipelines, team development, and clean environments.
Contents
- Features
- Installation
- Usage
- Automatic Context
- Log Table Migration
- Default Configuration
- Example Output (Discord)
- Laravel Compatibility
- About the Author
- License
๐ Laravel Extended Logger
๐ก Advanced Laravel logger that writes to Database, Discord, Telegram, and Slack โ with request context (
IP,user_id,route).
Replaces the monotonous Monolog output with clean, human-readable developer logs.
๐ Features
-
๐ฆ Multi-channel support:
- Database โ saves logs into
extended_logstable - Discord โ sends logs to a Discord channel via webhook
- Telegram โ sends logs to a chat/group/channel via Bot API
- Slack โ sends logs via Slack webhook (optional)
- Database โ saves logs into
-
๐ง Automatic context enrichment:
- Request IP address
- Authenticated user ID
- Current route or URI
-
๐ชถ Clean, human-readable formatting
-
โ๏ธ Fully configurable via
.env -
๐ฅ Compatible with Laravel 10, 11, and 12
โ๏ธ Installation
1. Install via Composer
composer require vendor/laravel-extended-logger
2. Publish config and migrations
php artisan vendor:publish --tag=extended-logger-config php artisan vendor:publish --tag=extended-logger-migrations php artisan migrate
3. Add a logging channel
In your config/logging.php file:
'channels' => [ 'extended' => [ 'driver' => 'extended', ], 'stack' => [ 'driver' => 'stack', 'channels' => ['extended', 'single'], 'ignore_exceptions' => true, ], ]
4. Configure your .env
# Database EXTLOG_TABLE=extended_logs EXTLOG_DB_LEVEL=debug # Discord EXTLOG_DISCORD_WEBHOOK=https://discord.com/api/webhooks/xxx/yyy EXTLOG_DISCORD_LEVEL=notice # Telegram EXTLOG_TELEGRAM_BOT_TOKEN=123456:AA... EXTLOG_TELEGRAM_CHAT_ID=123456789 EXTLOG_TELEGRAM_LEVEL=warning EXTLOG_TELEGRAM_PARSE_MODE=none # Slack EXTLOG_SLACK_WEBHOOK=https://hooks.slack.com/services/xxx/yyy/zzz EXTLOG_SLACK_LEVEL=error
โ ๏ธ Note: Log level (*_LEVEL) defines the minimum severity threshold. For example:
- notice โ catches everything from notice and above (warning, error, etc.)
- error โ catches only error, critical, alert, emergency
- debug โ catches everything
๐งฐ Usage
// default logger (if 'extended' is the default channel) logger()->warning('Payment failed', ['order_id' => 123]); // specific channel app('log')->channel('extended')->error('Telegram error report', [ 'feature' => 'payments', 'env' => app()->environment(), ]);
Messages are automatically sent to:
- Database (extended_logs)
- Discord (if enabled)
- Telegram (if enabled)
- Slack (if enabled)
๐ง Automatic Context
Each log entry automatically includes:
ip- the client IPuser_id- the authenticated user ID (if available)route- the current request path
Example DB Record
{
"level": "warning",
"message": "Payment failed",
"context": {"order_id":123},
"extra": {"ip":"127.0.0.1","user_id":1,"route":"payments/process"}
}
๐พ Log Table Migration
Schema::create('extended_logs', function (Blueprint $table) { $table->id(); $table->string('level', 32); $table->text('message'); $table->json('context')->nullable(); $table->json('extra')->nullable(); $table->string('ip', 64)->nullable(); $table->unsignedBigInteger('user_id')->nullable(); $table->string('route')->nullable(); $table->timestamps(); });
๐งฉ Default Configuration
config/extended-logger.php
return [ 'channels' => [ 'database' => true, 'discord' => env('EXTLOG_DISCORD_WEBHOOK') !== null, 'telegram' => env('EXTLOG_TELEGRAM_BOT_TOKEN') && env('EXTLOG_TELEGRAM_CHAT_ID'), 'slack' => env('EXTLOG_SLACK_WEBHOOK') !== null, ], 'levels' => [ 'database' => env('EXTLOG_DB_LEVEL', 'debug'), 'discord' => env('EXTLOG_DISCORD_LEVEL', 'warning'), 'telegram' => env('EXTLOG_TELEGRAM_LEVEL', 'error'), 'slack' => env('EXTLOG_SLACK_LEVEL', 'notice'), ], 'table' => env('EXTLOG_TABLE', 'extended_logs'), 'discord_webhook' => env('EXTLOG_DISCORD_WEBHOOK'), 'slack_webhook' => env('EXTLOG_SLACK_WEBHOOK'), 'telegram' => [ 'bot_token' => env('EXTLOG_TELEGRAM_BOT_TOKEN'), 'chat_id' => env('EXTLOG_TELEGRAM_CHAT_ID'), 'parse_mode' => env('EXTLOG_TELEGRAM_PARSE_MODE', 'none'), ], 'format' => "[%datetime%] %level_name%: %message% %context% %extra%\n", 'enrich_request_context' => true, ];
๐งพ Example Output (Discord)
| WARNING: Rate limit hit
| 2025-10-26 14:41:36
| ip: 127.0.0.1 | route: / | ctx: {"key":"steam_api"}
๐งฑ Laravel Compatibility
| Laravel | Supported |
|---|---|
| 10.x | โ |
| 11.x | โ |
| 12.x | โ |
๐งโ๐ป About the Author
Fragly Dev โ Building tools for modern Laravel & Next.js developers. Follow for more developer utilities, security helpers, and SaaS-ready boilerplates.
๐ License
This package is open-sourced software licensed under the MIT license.
๐ SEO Keywords
laravel logger package, laravel logging channels, laravel custom log driver,
laravel discord logs, laravel telegram logs, laravel slack integration,
laravel database logging, laravel error tracker, laravel error reporting,
laravel monolog replacement, laravel advanced logging, laravel log formatter,
laravel request context logger, laravel log to database, laravel log to discord,
laravel log to telegram, laravel log to slack, laravel extended logger,
laravel contextual logs, laravel log middleware, laravel devops tools,
laravel production logs, laravel debugging utilities, laravel log management,
laravel error monitoring, laravel discord webhook, laravel telegram bot logs,
laravel slack webhook logs, laravel notification logs, fragly laravel logger,
fragly extended logger, fragly.net laravel packages