1
0

Change logger to only be instantiated when explicitly enabled to not cause unneccessary debugging

especially in dev-installations
References #131
This commit is contained in:
Garvin Hicking
2014-05-19 11:12:47 +02:00
parent b8faaba829
commit eb07593088
6 changed files with 32 additions and 44 deletions

View File

@ -310,23 +310,16 @@ if (defined('USE_MEMSNAP')) {
serendipity_load_configuration();
$serendipity['lang'] = serendipity_getSessionLanguage();
if (! isset($serendipity['logLevel']) || $serendipity['logLevel'] === 'Automatic') {
if ($serendipity['production'] != true) {
if (isset($serendipity['logLevel']) && $serendipity['logLevel'] !== 'Off') {
if ($serendipity['logLevel'] == 'debug') {
$log_level = Psr\Log\LogLevel::DEBUG;
} else {
$log_level = Psr\Log\LogLevel::ERROR;
}
$serendipity['logger'] = new Katzgrau\KLogger\Logger($serendipity['serendipityPath'] . '/templates_c/logs', $log_level);
}
if ($serendipity['logLevel'] == 'error') {
$log_level = Psr\Log\LogLevel::ERROR;
}
if ($serendipity['logLevel'] == 'debug') {
$log_level = Psr\Log\LogLevel::DEBUG;
}
$serendipity['logger'] = new Katzgrau\KLogger\Logger($serendipity['serendipityPath'] . '/templates_c/logs', $log_level);
if ( (isset($serendipity['autodetect_baseURL']) && serendipity_db_bool($serendipity['autodetect_baseURL'])) ||
(isset($serendipity['embed']) && serendipity_db_bool($serendipity['embed'])) ) {
$serendipity['baseURL'] = 'http' . (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . (!strstr($_SERVER['HTTP_HOST'], ':') && !empty($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] != '80' && $_SERVER['SERVER_PORT'] != '443' ? ':' . $_SERVER['SERVER_PORT'] : '') . $serendipity['serendipityHTTPPath'];