diff options
author | 2023-06-02 20:22:09 +0200 | |
---|---|---|
committer | 2023-06-02 20:22:09 +0200 | |
commit | ee498eadf93a1e5ffdc7932ed1519c875eadcd7d (patch) | |
tree | 0e0aa312bafc4de6ee0f1d9b496114563c2cc69b /lib/Logger.php | |
parent | c5cd2294456c6a118885003f7beb6f32bb98bc68 (diff) | |
download | rss-bridge-ee498eadf93a1e5ffdc7932ed1519c875eadcd7d.tar.gz rss-bridge-ee498eadf93a1e5ffdc7932ed1519c875eadcd7d.tar.zst rss-bridge-ee498eadf93a1e5ffdc7932ed1519c875eadcd7d.zip |
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
Diffstat (limited to 'lib/Logger.php')
-rw-r--r-- | lib/Logger.php | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/Logger.php b/lib/Logger.php index 9bbdd512..e15035fe 100644 --- a/lib/Logger.php +++ b/lib/Logger.php @@ -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); } } |