mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-07-02 10:04:39 +02:00
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:
parent
c5cd229445
commit
ee498eadf9
18 changed files with 121 additions and 158 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue