fix: move debug mode to config (#3324)

* fix: move debug mode to config

* fix: also move debug_whitelist to .ini config

* fix: move logic back to Debug class

* docs

* docs

* fix: disable debug mode by default

* fix: restore previous behavior for alerts

* fix: center-align alert text
This commit is contained in:
Dag 2023-06-02 20:22:09 +02:00 committed by GitHub
parent c5cd229445
commit ee498eadf9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 121 additions and 158 deletions

View file

@ -6,9 +6,7 @@ final class Logger
{
public static function debug(string $message, array $context = [])
{
if (Debug::isEnabled()) {
self::log('DEBUG', $message, $context);
}
self::log('DEBUG', $message, $context);
}
public static function info(string $message, array $context = []): void
@ -28,6 +26,11 @@ final class Logger
private static function log(string $level, string $message, array $context = []): void
{
if (!Debug::isEnabled() && $level === 'DEBUG') {
// Don't log this debug log record because debug mode is disabled
return;
}
if (isset($context['e'])) {
/** @var \Throwable $e */
$e = $context['e'];
@ -66,7 +69,13 @@ final class Logger
$message,
$context ? Json::encode($context) : ''
);
// Log to stderr/stdout whatever that is
// todo: extract to log handler
error_log($text);
// Log to file
// todo: extract to log handler
//file_put_contents('/tmp/rss-bridge.log', $text, FILE_APPEND);
}
}