mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-06-29 18:21:07 +00:00
feat: logger config
This commit is contained in:
parent
9fb4a5dd72
commit
cd6b0f4f7d
@ -31,6 +31,10 @@ timezone = "UTC"
|
||||
; Display a system message to users.
|
||||
;message = "Hello world"
|
||||
|
||||
; Where to store logs and at which level (debug, info, warning, error)
|
||||
;log_file_path = "/tmp/rss-bridge.log"
|
||||
;log_file_level = "info"
|
||||
|
||||
; Whether to enable debug mode.
|
||||
enable_debug_mode = false
|
||||
|
||||
|
@ -52,8 +52,12 @@ $container['logger'] = function () {
|
||||
} else {
|
||||
$logger->addHandler(new ErrorLogHandler(Logger::INFO));
|
||||
}
|
||||
// Uncomment this for info logging to fs
|
||||
// $logger->addHandler(new StreamHandler('/tmp/rss-bridge.txt', Logger::INFO));
|
||||
$path = Configuration::getConfig('system', 'log_file_path');
|
||||
$level = Configuration::getConfig('system', 'log_file_level');
|
||||
if ($path && $level) {
|
||||
$level = array_flip(Logger::LEVEL_NAMES)[strtoupper($level)];
|
||||
$logger->addHandler(new StreamHandler($path, $level));
|
||||
}
|
||||
|
||||
// Uncomment this for debug logging to fs
|
||||
// $logger->addHandler(new StreamHandler('/tmp/rss-bridge-debug.txt', Logger::DEBUG));
|
||||
|
Loading…
Reference in New Issue
Block a user