Move log level to Environment; update changelog.
This commit is contained in:
parent
8b8ab43c86
commit
8f29382b9e
|
@ -9,7 +9,7 @@ release channel, you can take advantage of these new features and fixes.
|
|||
accessibility:
|
||||
- You can now edit the playlists associated with a track from directly within the "Edit" modal dialog box for that
|
||||
track.
|
||||
- If all of the tracks/directories selected are in a playlist, that playlist will be checked by default in the "Set
|
||||
- If all tracks/directories selected are in a playlist, that playlist will be checked by default in the "Set
|
||||
Playlists" dropdown.
|
||||
|
||||
## Code Quality/Technical Changes
|
||||
|
@ -22,6 +22,9 @@ release channel, you can take advantage of these new features and fixes.
|
|||
|
||||
- If your browser sends a locale like `fr` instead of `fr_FR`, it will now be supported and detected (#3558).
|
||||
|
||||
- Fixed a bug where sometimes changes to media metadata would be saved, only for the next 5-minute synchronization
|
||||
process to revert to the previous data (#3553).
|
||||
|
||||
---
|
||||
|
||||
# AzuraCast 0.11.2 (Dec 11, 2020)
|
||||
|
|
|
@ -242,27 +242,7 @@ return [
|
|||
// Monolog Logger
|
||||
Monolog\Logger::class => function (Environment $environment) {
|
||||
$logger = new Monolog\Logger($environment->getAppName());
|
||||
|
||||
$loggingLevel = null;
|
||||
if (!empty($_ENV['LOG_LEVEL'])) {
|
||||
$allowedLogLevels = [
|
||||
Psr\Log\LogLevel::DEBUG,
|
||||
Psr\Log\LogLevel::INFO,
|
||||
Psr\Log\LogLevel::NOTICE,
|
||||
Psr\Log\LogLevel::WARNING,
|
||||
Psr\Log\LogLevel::ERROR,
|
||||
Psr\Log\LogLevel::CRITICAL,
|
||||
Psr\Log\LogLevel::ALERT,
|
||||
Psr\Log\LogLevel::EMERGENCY,
|
||||
];
|
||||
|
||||
$loggingLevel = strtolower($_ENV['LOG_LEVEL']);
|
||||
if (!in_array($loggingLevel, $allowedLogLevels, true)) {
|
||||
$loggingLevel = null;
|
||||
}
|
||||
}
|
||||
|
||||
$loggingLevel ??= $environment->isProduction() ? Psr\Log\LogLevel::NOTICE : Psr\Log\LogLevel::DEBUG;
|
||||
$loggingLevel = $environment->getLogLevel();
|
||||
|
||||
if ($environment->isDocker() || $environment->isCli()) {
|
||||
$log_stderr = new Monolog\Handler\StreamHandler('php://stderr', $loggingLevel, true);
|
||||
|
|
|
@ -4,6 +4,7 @@ namespace App;
|
|||
|
||||
use App\Radio\Configuration;
|
||||
use App\Traits\AvailableStaticallyTrait;
|
||||
use Psr\Log\LogLevel;
|
||||
|
||||
class Environment
|
||||
{
|
||||
|
@ -47,6 +48,8 @@ class Environment
|
|||
public const SYNC_SHORT_EXECUTION_TIME = 'SYNC_SHORT_EXECUTION_TIME';
|
||||
public const SYNC_LONG_EXECUTION_TIME = 'SYNC_LONG_EXECUTION_TIME';
|
||||
|
||||
public const LOG_LEVEL = 'LOG_LEVEL';
|
||||
|
||||
// Default settings
|
||||
protected array $defaults = [
|
||||
self::APP_NAME => 'AzuraCast',
|
||||
|
@ -235,4 +238,30 @@ class Environment
|
|||
{
|
||||
return (int)($this->data[self::SYNC_LONG_EXECUTION_TIME] ?? 1800);
|
||||
}
|
||||
|
||||
public function getLogLevel(): string
|
||||
{
|
||||
if (!empty($this->data[self::LOG_LEVEL])) {
|
||||
$loggingLevel = strtolower($this->data[self::LOG_LEVEL]);
|
||||
|
||||
$allowedLogLevels = [
|
||||
LogLevel::DEBUG,
|
||||
LogLevel::INFO,
|
||||
LogLevel::NOTICE,
|
||||
LogLevel::WARNING,
|
||||
LogLevel::ERROR,
|
||||
LogLevel::CRITICAL,
|
||||
LogLevel::ALERT,
|
||||
LogLevel::EMERGENCY,
|
||||
];
|
||||
|
||||
if (in_array($loggingLevel, $allowedLogLevels, true)) {
|
||||
return $loggingLevel;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->isProduction()
|
||||
? LogLevel::NOTICE
|
||||
: LogLevel::DEBUG;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -123,12 +123,13 @@ class GetId3MetadataManager implements MetadataManagerInterface
|
|||
|
||||
$tagwriter->tag_data = $tagData;
|
||||
|
||||
$writeTagsResult = $tagwriter->WriteTags();
|
||||
$tagwriter->WriteTags();
|
||||
|
||||
if (false === $writeTagsResult) {
|
||||
if (!empty($tagwriter->errors) || !empty($tagwriter->warnings)) {
|
||||
$messages = array_merge($tagwriter->errors, $tagwriter->warnings);
|
||||
throw CannotProcessMediaException::forPath(
|
||||
$path,
|
||||
implode(', ', $tagwriter->errors)
|
||||
implode(', ', $messages)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue