error_log() to \SnappyMail\LOG::*()

This commit is contained in:
djmaze 2021-12-27 12:44:49 +01:00
parent 3fc5da50ef
commit f2388bb936
8 changed files with 15 additions and 15 deletions

View file

@ -49,7 +49,7 @@ trait Metadata
} }
} }
} catch (\Throwable $e) { } catch (\Throwable $e) {
//\error_log($e->getMessage()); //\SnappyMail\LOG::warning('IMAP', $e->getMessage());
} }
return $aReturn; return $aReturn;
} }

View file

@ -1172,7 +1172,7 @@ class ImapClient extends \MailSo\Net\NetClient
// RFC 5530 // RFC 5530
if ($sEndTag === $oResponse->Tag && \is_array($oResponse->OptionalResponse) && 'CLIENTBUG' === $oResponse->OptionalResponse[0]) { if ($sEndTag === $oResponse->Tag && \is_array($oResponse->OptionalResponse) && 'CLIENTBUG' === $oResponse->OptionalResponse[0]) {
// The server has detected a client bug. // The server has detected a client bug.
// \error_log("IMAP {$oResponse->OptionalResponse[0]}: {$this->lastCommand}"); // \SnappyMail\LOG::warning('IMAP', "{$oResponse->OptionalResponse[0]}: {$this->lastCommand}");
} }
if ($sEndTag === $oResponse->Tag || Enumerations\ResponseType::CONTINUATION === $oResponse->ResponseType) { if ($sEndTag === $oResponse->Tag || Enumerations\ResponseType::CONTINUATION === $oResponse->ResponseType) {
@ -1218,7 +1218,7 @@ class ImapClient extends \MailSo\Net\NetClient
// RFC 5530 // RFC 5530
if ($sEndTag === $oResponse->Tag && \is_array($oResponse->OptionalResponse) && 'CLIENTBUG' === $oResponse->OptionalResponse[0]) { if ($sEndTag === $oResponse->Tag && \is_array($oResponse->OptionalResponse) && 'CLIENTBUG' === $oResponse->OptionalResponse[0]) {
// The server has detected a client bug. // The server has detected a client bug.
// \error_log("IMAP {$oResponse->OptionalResponse[0]}: {$this->lastCommand}"); // \SnappyMail\LOG::warning('IMAP', "{$oResponse->OptionalResponse[0]}: {$this->lastCommand}");
} }
if ($sEndTag === $oResponse->Tag || Enumerations\ResponseType::CONTINUATION === $oResponse->ResponseType) { if ($sEndTag === $oResponse->Tag || Enumerations\ResponseType::CONTINUATION === $oResponse->ResponseType) {

View file

@ -183,7 +183,7 @@ trait ResponseParser
$this->writeLog('{'.$iLiteralSize.'} '.$sLiteral, \MailSo\Log\Enumerations\Type::INFO); $this->writeLog('{'.$iLiteralSize.'} '.$sLiteral, \MailSo\Log\Enumerations\Type::INFO);
} }
} else { } else {
\error_log('Literal treated as atom and skipped'); \SnappyMail\LOG::notice('IMAP', 'Literal treated as atom and skipped');
} }
unset($sLiteral); unset($sLiteral);
} else { } else {
@ -238,7 +238,7 @@ trait ResponseParser
default: default:
case "\r": case "\r":
case "\n": case "\n":
\error_log('Invalid char in quoted string: "' . \substr($this->sResponseBuffer, $iPos, $iOffset + $iLength - $iPos) . '"'); \SnappyMail\LOG::notice('IMAP', 'Invalid char in quoted string: "' . \substr($this->sResponseBuffer, $iPos, $iOffset + $iLength - $iPos) . '"');
// Not allowed in quoted string // Not allowed in quoted string
break 2; break 2;
} }

View file

@ -1190,7 +1190,7 @@ class MailClient
if ($this->oImapClient->IsSupported('LIST-EXTENDED')) { if ($this->oImapClient->IsSupported('LIST-EXTENDED')) {
$bUseListSubscribeStatus = false; $bUseListSubscribeStatus = false;
} else if ($bUseListSubscribeStatus) { } else if ($bUseListSubscribeStatus) {
//\error_log('RFC5258 not supported, using LSUB'); //\SnappyMail\LOG::warning('IMAP', 'RFC5258 not supported, using LSUB');
try try
{ {
$aSubscribedFolders = $this->oImapClient->FolderSubscribeList($sParent, $sListPattern); $aSubscribedFolders = $this->oImapClient->FolderSubscribeList($sParent, $sListPattern);
@ -1202,7 +1202,7 @@ class MailClient
} }
catch (\Throwable $oException) catch (\Throwable $oException)
{ {
\error_log('ERROR FolderSubscribeList: ' . $oException->getMessage()); \SnappyMail\LOG::error('IMAP', 'FolderSubscribeList: ' . $oException->getMessage());
} }
} }

View file

@ -509,7 +509,7 @@ trait Messages
} }
catch (\Throwable $oException) catch (\Throwable $oException)
{ {
\error_log("FolderHash({$sFolder}) Exception: {$oException->getMessage()}"); \SnappyMail\LOG::warning("FolderHash({$sFolder}) Exception: {$oException->getMessage()}");
} }
return $this->DefaultResponse(__FUNCTION__, $sHash ? array($sFolder, $sHash) : array($sFromFolder)); return $this->DefaultResponse(__FUNCTION__, $sHash ? array($sFolder, $sHash) : array($sFromFolder));
@ -572,7 +572,7 @@ trait Messages
} }
catch (\Throwable $oException) catch (\Throwable $oException)
{ {
\error_log("FolderHash({$sFromFolder}) Exception: {$oException->getMessage()}"); \SnappyMail\LOG::warning("FolderHash({$sFromFolder}) Exception: {$oException->getMessage()}");
} }
return $this->DefaultResponse(__FUNCTION__, $sHash ? array($sFromFolder, $sHash) : array($sFromFolder)); return $this->DefaultResponse(__FUNCTION__, $sHash ? array($sFromFolder, $sHash) : array($sFromFolder));

View file

@ -158,9 +158,9 @@ class ServiceActions
} }
catch (\Throwable $oException) catch (\Throwable $oException)
{ {
\error_log($oException->getMessage()); \SnappyMail\LOG::warning('SERVICE', $oException->getMessage());
if ($e = $oException->getPrevious()) { if ($e = $oException->getPrevious()) {
\error_log("\t{$e->getMessage()} @ {$e->getFile()}#{$e->getLine()}"); \SnappyMail\LOG::warning('SERVICE', "\t{$e->getMessage()} @ {$e->getFile()}#{$e->getLine()}");
} }
$aResponseItem = $this->oActions->ExceptionResponse( $aResponseItem = $this->oActions->ExceptionResponse(

View file

@ -24,7 +24,7 @@ class Exif
if (false !== $exif) { if (false !== $exif) {
return \max(0, \intval($exif['IFD0.Orientation'] ?? 0)); return \max(0, \intval($exif['IFD0.Orientation'] ?? 0));
} }
\error_log("{$image_info['mime']} " . \error_get_last()['message']); \SnappyMail\LOG::warning('EXIF', "{$image_info['mime']} " . \error_get_last()['message']);
} }
return 0; return 0;
} }

View file

@ -80,14 +80,14 @@ abstract class Upgrade
\hash_hmac('sha1', '', $sHash) \hash_hmac('sha1', '', $sHash)
]; ];
if (!$sToken) { if (!$sToken) {
\error_log("ConvertInsecureAccount {$sEmail} no token"); \SnappyMail\LOG::warning('UPGRADE', "ConvertInsecureAccount {$sEmail} no token");
continue; continue;
} }
$aAccountHash = \RainLoop\Utils::DecodeKeyValues($sToken); $aAccountHash = \RainLoop\Utils::DecodeKeyValues($sToken);
if (empty($aAccountHash[0]) || 'token' !== $aAccountHash[0] // simple token validation if (empty($aAccountHash[0]) || 'token' !== $aAccountHash[0] // simple token validation
|| 8 > \count($aAccountHash) // length checking || 8 > \count($aAccountHash) // length checking
) { ) {
\error_log("ConvertInsecureAccount {$sEmail} invalid aAccountHash: " . \print_r($aAccountHash,1)); \SnappyMail\LOG::warning('UPGRADE', "ConvertInsecureAccount {$sEmail} invalid aAccountHash: " . \print_r($aAccountHash,1));
continue; continue;
} }
$aAccountHash[3] = Crypt::EncryptUrlSafe($aAccountHash[3], $sHash); $aAccountHash[3] = Crypt::EncryptUrlSafe($aAccountHash[3], $sHash);
@ -103,7 +103,7 @@ abstract class Upgrade
\hash_hmac('sha1', $aAccountHash[3], $sHash) \hash_hmac('sha1', $aAccountHash[3], $sHash)
]; ];
} catch (\Throwable $e) { } catch (\Throwable $e) {
\error_log("ConvertInsecureAccount {$sEmail} failed"); \SnappyMail\LOG::warning('UPGRADE', "ConvertInsecureAccount {$sEmail} failed");
} }
} }