mirror of
https://github.com/rico-vz/HeimerdingerLoL.git
synced 2025-12-06 10:10:48 +01:00
feat: Add Discord logging support
- Added Discord webhook URL to .env.example - Included 'marvinlabs/laravel-discord-logger' in composer.json - Created config file for Discord logger settings
This commit is contained in:
@@ -5,6 +5,8 @@ APP_DEBUG=true
|
||||
APP_TIMEZONE=Europe/Amsterdam
|
||||
APP_URL=http://127.0.0.1:8000
|
||||
|
||||
LOG_DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/
|
||||
|
||||
APP_LOCALE=en
|
||||
APP_FALLBACK_LOCALE=en
|
||||
APP_FAKER_LOCALE=en_US
|
||||
@@ -36,7 +38,7 @@ HCAPTCHA_SECRET=secret-key
|
||||
HCAPTCHA_SITEKEY=site-key
|
||||
|
||||
LOG_CHANNEL=stack
|
||||
LOG_STACK=single
|
||||
LOG_STACK=single,discord
|
||||
LOG_DEPRECATIONS_CHANNEL=null
|
||||
LOG_LEVEL=debug
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
"laravel/sanctum": "^4.0",
|
||||
"laravel/tinker": "^2.9",
|
||||
"league/flysystem-aws-s3-v3": "^3.0",
|
||||
"marvinlabs/laravel-discord-logger": "^1.4",
|
||||
"saade/blade-iconsax": "^1.2",
|
||||
"scyllaly/hcaptcha": "dev-l11-compatibility",
|
||||
"spatie/laravel-backup": "^8.6",
|
||||
|
||||
72
composer.lock
generated
72
composer.lock
generated
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "300044012c721a5f7c149e7c0f8c3aa0",
|
||||
"content-hash": "01991fbc1fe35d4ff8b7fec2328024e4",
|
||||
"packages": [
|
||||
{
|
||||
"name": "andcarpi/laravel-popper",
|
||||
@@ -2962,6 +2962,76 @@
|
||||
],
|
||||
"time": "2024-03-14T14:03:32+00:00"
|
||||
},
|
||||
{
|
||||
"name": "marvinlabs/laravel-discord-logger",
|
||||
"version": "v1.4.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/marvinlabs/laravel-discord-logger.git",
|
||||
"reference": "e8a53579dcb4650cf1c362829f90cb9580249209"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/marvinlabs/laravel-discord-logger/zipball/e8a53579dcb4650cf1c362829f90cb9580249209",
|
||||
"reference": "e8a53579dcb4650cf1c362829f90cb9580249209",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-json": "*",
|
||||
"guzzlehttp/guzzle": "^6.3|^7.0",
|
||||
"illuminate/support": "^7.0|^8.0|^9.0|^10.0 | ^11.0",
|
||||
"php": ">=7.3 | ^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"mockery/mockery": "^1.0",
|
||||
"orchestra/testbench": "^5.0|^6.0|^8.0 | ^9.0",
|
||||
"phpunit/phpunit": "^8.0|^9.0 | ^10.5",
|
||||
"roave/security-advisories": "dev-master"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"MarvinLabs\\DiscordLogger\\ServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"MarvinLabs\\DiscordLogger\\": "src/DiscordLogger"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Vincent Mimoun-Prat",
|
||||
"email": "contact@vincentprat.info",
|
||||
"homepage": "https://vincentprat.info",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "Logging to a discord channel in Laravel",
|
||||
"keywords": [
|
||||
"discord",
|
||||
"laravel",
|
||||
"logger",
|
||||
"logging"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/marvinlabs/laravel-discord-logger/issues",
|
||||
"source": "https://github.com/marvinlabs/laravel-discord-logger/tree/v1.4.2"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/vpratfr",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2024-03-25T08:51:09+00:00"
|
||||
},
|
||||
{
|
||||
"name": "masterminds/html5",
|
||||
"version": "2.8.1",
|
||||
|
||||
61
config/discord-logger.php
Normal file
61
config/discord-logger.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
* The author of the log messages. You can set both to null to keep the Webhook author set in Discord
|
||||
*/
|
||||
'from' => [
|
||||
'name' => env('APP_NAME', 'Heimerdinger Logger'),
|
||||
'avatar_url' => null,
|
||||
],
|
||||
|
||||
/**
|
||||
* The converter to use to turn a log record into a discord message
|
||||
*
|
||||
* Bundled converters:
|
||||
* - \MarvinLabs\DiscordLogger\Converters\SimpleRecordConverter::class
|
||||
* - \MarvinLabs\DiscordLogger\Converters\RichRecordConverter::class
|
||||
*/
|
||||
'converter' => \MarvinLabs\DiscordLogger\Converters\RichRecordConverter::class,
|
||||
|
||||
/**
|
||||
* If enabled, stacktraces will be attached as files. If not, stacktraces will be directly printed out in the
|
||||
* message.
|
||||
*
|
||||
* Valid values are:
|
||||
*
|
||||
* - 'smart': when stacktrace is less than 2000 characters, it is inlined with the message, else attached as file
|
||||
* - 'file': stacktrace is always attached as file
|
||||
* - 'inline': stacktrace is always inlined with the message, truncated if necessary
|
||||
*/
|
||||
'stacktrace' => 'smart',
|
||||
|
||||
/*
|
||||
* A set of colors to associate to the different log levels when using the `RichRecordConverter`
|
||||
*/
|
||||
'colors' => [
|
||||
'DEBUG' => 0x607d8b,
|
||||
'INFO' => 0x4caf50,
|
||||
'NOTICE' => 0x2196f3,
|
||||
'WARNING' => 0xff9800,
|
||||
'ERROR' => 0xf44336,
|
||||
'CRITICAL' => 0xe91e63,
|
||||
'ALERT' => 0x673ab7,
|
||||
'EMERGENCY' => 0x9c27b0,
|
||||
],
|
||||
|
||||
/*
|
||||
* A set of emojis to associate to the different log levels. Set to null to disable an emoji for a given level
|
||||
*/
|
||||
'emojis' => [
|
||||
'DEBUG' => ':beetle:',
|
||||
'INFO' => ':bulb:',
|
||||
'NOTICE' => ':wink:',
|
||||
'WARNING' => ':flushed:',
|
||||
'ERROR' => ':poop:',
|
||||
'CRITICAL' => ':imp:',
|
||||
'ALERT' => ':japanese_ogre:',
|
||||
'EMERGENCY' => ':skull:',
|
||||
],
|
||||
];
|
||||
140
config/logging.php
Normal file
140
config/logging.php
Normal file
@@ -0,0 +1,140 @@
|
||||
<?php
|
||||
|
||||
use Monolog\Handler\NullHandler;
|
||||
use Monolog\Handler\StreamHandler;
|
||||
use Monolog\Handler\SyslogUdpHandler;
|
||||
use Monolog\Processor\PsrLogMessageProcessor;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Log Channel
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option defines the default log channel that is utilized to write
|
||||
| messages to your logs. The value provided here should match one of
|
||||
| the channels present in the list of "channels" configured below.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('LOG_CHANNEL', 'stack'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Deprecations Log Channel
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the log channel that should be used to log warnings
|
||||
| regarding deprecated PHP and library features. This allows you to get
|
||||
| your application ready for upcoming major versions of dependencies.
|
||||
|
|
||||
*/
|
||||
|
||||
'deprecations' => [
|
||||
'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
|
||||
'trace' => env('LOG_DEPRECATIONS_TRACE', false),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Log Channels
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure the log channels for your application. Laravel
|
||||
| utilizes the Monolog PHP logging library, which includes a variety
|
||||
| of powerful log handlers and formatters that you're free to use.
|
||||
|
|
||||
| Available Drivers: "single", "daily", "slack", "syslog",
|
||||
| "errorlog", "monolog", "custom", "stack"
|
||||
|
|
||||
*/
|
||||
|
||||
'channels' => [
|
||||
|
||||
'stack' => [
|
||||
'driver' => 'stack',
|
||||
'channels' => explode(',', env('LOG_STACK', 'single')),
|
||||
'ignore_exceptions' => false,
|
||||
],
|
||||
|
||||
'single' => [
|
||||
'driver' => 'single',
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'daily' => [
|
||||
'driver' => 'daily',
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'days' => env('LOG_DAILY_DAYS', 14),
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'slack' => [
|
||||
'driver' => 'slack',
|
||||
'url' => env('LOG_SLACK_WEBHOOK_URL'),
|
||||
'username' => env('LOG_SLACK_USERNAME', 'Laravel Log'),
|
||||
'emoji' => env('LOG_SLACK_EMOJI', ':boom:'),
|
||||
'level' => env('LOG_LEVEL', 'critical'),
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'discord' => [
|
||||
'driver' => 'custom',
|
||||
'via' => \MarvinLabs\DiscordLogger\Logger::class,
|
||||
'level' => 'debug',
|
||||
'url' => env('LOG_DISCORD_WEBHOOK_URL'),
|
||||
'ignore_exceptions' => env('LOG_DISCORD_IGNORE_EXCEPTIONS', false),
|
||||
],
|
||||
|
||||
'papertrail' => [
|
||||
'driver' => 'monolog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class),
|
||||
'handler_with' => [
|
||||
'host' => env('PAPERTRAIL_URL'),
|
||||
'port' => env('PAPERTRAIL_PORT'),
|
||||
'connectionString' => 'tls://' . env('PAPERTRAIL_URL') . ':' . env('PAPERTRAIL_PORT'),
|
||||
],
|
||||
'processors' => [PsrLogMessageProcessor::class],
|
||||
],
|
||||
|
||||
'stderr' => [
|
||||
'driver' => 'monolog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'handler' => StreamHandler::class,
|
||||
'formatter' => env('LOG_STDERR_FORMATTER'),
|
||||
'with' => [
|
||||
'stream' => 'php://stderr',
|
||||
],
|
||||
'processors' => [PsrLogMessageProcessor::class],
|
||||
],
|
||||
|
||||
'syslog' => [
|
||||
'driver' => 'syslog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'facility' => env('LOG_SYSLOG_FACILITY', LOG_USER),
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'errorlog' => [
|
||||
'driver' => 'errorlog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'null' => [
|
||||
'driver' => 'monolog',
|
||||
'handler' => NullHandler::class,
|
||||
],
|
||||
|
||||
'emergency' => [
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
Reference in New Issue
Block a user