Replaced deprecated "log" function call

This commit is contained in:
Michael 2021-11-03 23:19:24 +00:00
parent 9f411b0c76
commit 24ee87224f
14 changed files with 101 additions and 160 deletions

View file

@ -219,7 +219,7 @@ class Profile
{
$profile = User::getOwnerDataByNick($nickname);
if (empty($profile)) {
Logger::log('profile error: ' . DI::args()->getQueryString(), Logger::DEBUG);
Logger::info('profile error: ' . DI::args()->getQueryString());
return [];
}
@ -706,27 +706,27 @@ class Profile
// Try to find the public contact entry of the visitor.
$cid = Contact::getIdForURL($my_url);
if (!$cid) {
Logger::log('No contact record found for ' . $my_url, Logger::DEBUG);
Logger::info('No contact record found for ' . $my_url);
return;
}
$contact = DBA::selectFirst('contact',['id', 'url'], ['id' => $cid]);
if (DBA::isResult($contact) && remote_user() && remote_user() == $contact['id']) {
Logger::log('The visitor ' . $my_url . ' is already authenticated', Logger::DEBUG);
Logger::info('The visitor ' . $my_url . ' is already authenticated');
return;
}
// Avoid endless loops
$cachekey = 'zrlInit:' . $my_url;
if (DI::cache()->get($cachekey)) {
Logger::log('URL ' . $my_url . ' already tried to authenticate.', Logger::DEBUG);
Logger::info('URL ' . $my_url . ' already tried to authenticate.');
return;
} else {
DI::cache()->set($cachekey, true, Duration::MINUTE);
}
Logger::log('Not authenticated. Invoking reverse magic-auth for ' . $my_url, Logger::DEBUG);
Logger::info('Not authenticated. Invoking reverse magic-auth for ' . $my_url);
// Remove the "addr" parameter from the destination. It is later added as separate parameter again.
$addr_request = 'addr=' . urlencode($addr);
@ -745,7 +745,7 @@ class Profile
// We have to check if the remote server does understand /magic without invoking something
$serverret = DI::httpClient()->get($basepath . '/magic');
if ($serverret->isSuccess()) {
Logger::log('Doing magic auth for visitor ' . $my_url . ' to ' . $magic_path, Logger::DEBUG);
Logger::info('Doing magic auth for visitor ' . $my_url . ' to ' . $magic_path);
System::externalRedirect($magic_path);
}
}
@ -845,7 +845,7 @@ class Profile
info(DI::l10n()->t('OpenWebAuth: %1$s welcomes %2$s', DI::baseUrl()->getHostname(), $visitor['name']));
Logger::log('OpenWebAuth: auth success from ' . $visitor['addr'], Logger::DEBUG);
Logger::info('OpenWebAuth: auth success from ' . $visitor['addr']);
}
public static function zrl($s, $force = false)

View file

@ -64,7 +64,7 @@ class PushSubscriber
$priority = $default_priority;
}
Logger::log('Publish feed to ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' with priority ' . $priority, Logger::DEBUG);
Logger::info('Publish feed to ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' with priority ' . $priority);
Worker::add($priority, 'PubSubPublish', (int)$subscriber['id']);
}
@ -108,9 +108,9 @@ class PushSubscriber
'secret' => $hub_secret];
DBA::insert('push_subscriber', $fields);
Logger::log("Successfully subscribed [$hub_callback] for $nick");
Logger::notice("Successfully subscribed [$hub_callback] for $nick");
} else {
Logger::log("Successfully unsubscribed [$hub_callback] for $nick");
Logger::notice("Successfully unsubscribed [$hub_callback] for $nick");
// we do nothing here, since the row was already deleted
}
}
@ -136,10 +136,10 @@ class PushSubscriber
if ($days > 60) {
DBA::update('push_subscriber', ['push' => -1, 'next_try' => DBA::NULL_DATETIME], ['id' => $id]);
Logger::log('Delivery error: Subscription ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' is marked as ended.', Logger::DEBUG);
Logger::info('Delivery error: Subscription ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' is marked as ended.');
} else {
DBA::update('push_subscriber', ['push' => 0, 'next_try' => DBA::NULL_DATETIME], ['id' => $id]);
Logger::log('Delivery error: Giving up ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' for now.', Logger::DEBUG);
Logger::info('Delivery error: Giving up ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' for now.');
}
} else {
// Calculate the delay until the next trial
@ -149,7 +149,7 @@ class PushSubscriber
$retrial = $retrial + 1;
DBA::update('push_subscriber', ['push' => $retrial, 'next_try' => $next], ['id' => $id]);
Logger::log('Delivery error: Next try (' . $retrial . ') ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' at ' . $next, Logger::DEBUG);
Logger::info('Delivery error: Next try (' . $retrial . ') ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' at ' . $next);
}
}
@ -170,7 +170,7 @@ class PushSubscriber
// set last_update to the 'created' date of the last item, and reset push=0
$fields = ['push' => 0, 'next_try' => DBA::NULL_DATETIME, 'last_update' => $last_update];
DBA::update('push_subscriber', $fields, ['id' => $id]);
Logger::log('Subscriber ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' is marked as vital', Logger::DEBUG);
Logger::info('Subscriber ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' is marked as vital');
$parts = parse_url($subscriber['callback_url']);
unset($parts['path']);

View file

@ -979,7 +979,7 @@ class User
$username_max_length = max(1, min(64, intval(DI::config()->get('system', 'username_max_length', 48))));
if ($username_min_length > $username_max_length) {
Logger::log(DI::l10n()->t('system.username_min_length (%s) and system.username_max_length (%s) are excluding each other, swapping values.', $username_min_length, $username_max_length), Logger::WARNING);
Logger::error(DI::l10n()->t('system.username_min_length (%s) and system.username_max_length (%s) are excluding each other, swapping values.', $username_min_length, $username_max_length));
$tmp = $username_min_length;
$username_min_length = $username_max_length;
$username_max_length = $tmp;