Improve Logger calls

- Replace various deprecated Logger::log calls
- Reassign log level for verbose log calls
This commit is contained in:
Hypolite Petovan 2019-02-22 23:00:16 -05:00
parent 1917f04153
commit 8c1db51a76
9 changed files with 29 additions and 24 deletions

View file

@ -289,7 +289,7 @@ class Processor
$item['owner-link'] = $activity['actor'];
$item['owner-id'] = Contact::getIdForURL($activity['actor'], 0, true);
} else {
Logger::log('Ignoring actor because of thread completion.', Logger::DEBUG);
Logger::info('Ignoring actor because of thread completion.');
$item['owner-link'] = $item['author-link'];
$item['owner-id'] = $item['author-id'];
}
@ -358,7 +358,11 @@ class Processor
}
$item_id = Item::insert($item);
Logger::log('Storing for user ' . $item['uid'] . ': ' . $item_id);
if ($item_id) {
Logger::info('Item insertion successful', ['user' => $item['uid'], 'item_id' => $item_id]);
} else {
Logger::notice('Item insertion aborted', ['user' => $item['uid']]);
}
if ($item['uid'] == 0) {
$stored = $item_id;

View file

@ -62,16 +62,16 @@ class Receiver
{
$http_signer = HTTPSignature::getSigner($body, $header);
if (empty($http_signer)) {
Logger::log('Invalid HTTP signature, message will be discarded.', Logger::DEBUG);
Logger::warning('Invalid HTTP signature, message will be discarded.');
return;
} else {
Logger::log('HTTP signature is signed by ' . $http_signer, Logger::DEBUG);
Logger::info('Valid HTTP signature', ['signer' => $http_signer]);
}
$activity = json_decode($body, true);
if (empty($activity)) {
Logger::log('Invalid body.', Logger::DEBUG);
Logger::warning('Invalid body.');
return;
}
@ -79,7 +79,7 @@ class Receiver
$actor = JsonLD::fetchElement($ldactivity, 'as:actor');
Logger::log('Message for user ' . $uid . ' is from actor ' . $actor, Logger::DEBUG);
Logger::info('Message for user ' . $uid . ' is from actor ' . $actor);
if (LDSignature::isSigned($activity)) {
$ld_signer = LDSignature::getSigner($activity);

View file

@ -1546,7 +1546,7 @@ class DFRN
$author["network"] = $contact_old["network"];
} else {
if (!$onlyfetch) {
Logger::log("Contact ".$author["link"]." wasn't found for user ".$importer["importer_uid"]." XML: ".$xml, Logger::DEBUG);
Logger::debug("Contact ".$author["link"]." wasn't found for user ".$importer["importer_uid"]." XML: ".$xml);
}
$author["contact-unknown"] = true;

View file

@ -942,7 +942,7 @@ class Diaspora
$person = DBA::selectFirst('fcontact', [], ['network' => Protocol::DIASPORA, 'addr' => $handle]);
if (DBA::isResult($person)) {
Logger::log("In cache " . print_r($person, true), Logger::DEBUG);
Logger::debug("In cache " . print_r($person, true));
// update record occasionally so it doesn't get stale
$d = strtotime($person["updated"]." +00:00");