Primo Committ
This commit is contained in:
29
vendor/facade/ignition/src/Exceptions/InvalidConfig.php
vendored
Normal file
29
vendor/facade/ignition/src/Exceptions/InvalidConfig.php
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace Facade\Ignition\Exceptions;
|
||||
|
||||
use Exception;
|
||||
use Facade\IgnitionContracts\BaseSolution;
|
||||
use Facade\IgnitionContracts\ProvidesSolution;
|
||||
use Facade\IgnitionContracts\Solution;
|
||||
use Monolog\Logger;
|
||||
|
||||
class InvalidConfig extends Exception implements ProvidesSolution
|
||||
{
|
||||
public static function invalidLogLevel(string $logLevel)
|
||||
{
|
||||
return new static("Invalid log level `{$logLevel}` specified.");
|
||||
}
|
||||
|
||||
public function getSolution(): Solution
|
||||
{
|
||||
$validLogLevels = array_map(function (string $level) {
|
||||
return strtolower($level);
|
||||
}, array_keys(Logger::getLevels()));
|
||||
|
||||
$validLogLevelsString = implode(',', $validLogLevels);
|
||||
|
||||
return BaseSolution::create('You provided an invalid log level')
|
||||
->setSolutionDescription("Please change the log level in your `config/logging.php` file. Valid log levels are {$validLogLevelsString}.");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user