Improved logging

This commit is contained in:
the-djmaze 2022-02-04 15:03:11 +01:00
parent 7fec4e849b
commit 26d3509e28
3 changed files with 8 additions and 4 deletions

View file

@ -227,6 +227,7 @@ class Utils
return true;
}
}
\SnappyMail\Log::warning("open_basedir restriction in effect. {$name} is not within the allowed path(s): " . \ini_get('open_basedir'));
return false;
}
return true;

View file

@ -49,8 +49,11 @@ abstract class Log
protected static function log(int $level, string $prefix, string $msg)
{
static $log_level;
// Default to level 4, 0 = LOG_EMERG, 7 = LOG_DEBUG
$log_level = \RainLoop\Api::Config()->Get('logs', 'level', \LOG_WARNING);
if (!$log_level) {
$log_level = \max(3, \RainLoop\Api::Config()->Get('logs', 'level', \LOG_WARNING));
}
if ($level <= $log_level) {
\RainLoop\Api::Logger()->Write(
$msg,

View file

@ -370,10 +370,10 @@ class GnuPG
: $this->GPG->verify($signed_text, $signature, $plaintext);
if (!$result) {
if ($this->GnuPG) {
\error_log('gnupg_verify() failed: ' . $this->GnuPG->geterror() . "\n\n{$signed_text}\n\n{$signature}" );
\error_log(\print_r($this->GnuPG->geterrorinfo(),1));
\SnappyMail\Log::notice('gnupg_verify() failed: ' . $this->GnuPG->geterror());
\SnappyMail\Log::info(\print_r($this->GnuPG->geterrorinfo(),1));
} else {
\error_log('GPG->verify() failed');
\SnappyMail\Log::notice('GPG->verify() failed');
}
}
return $result;