Skip to content

Commit

Permalink
Replace call for Logger with DI::logger() in diaspora addon
Browse files Browse the repository at this point in the history
  • Loading branch information
Art4 committed Jan 24, 2025
1 parent 1d1a00d commit 4881e60
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions diaspora/diaspora.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

use Friendica\Content\Text\BBCode;
use Friendica\Core\Hook;
use Friendica\Core\Logger;
use Friendica\Core\Renderer;
use Friendica\Database\DBA;
use Friendica\Core\Worker;
Expand Down Expand Up @@ -186,7 +185,7 @@ function diaspora_send(array &$b)
{
$hostname = DI::baseUrl()->getHost();

Logger::notice('diaspora_send: invoked');
DI::logger()->notice('diaspora_send: invoked');

if ($b['deleted'] || ($b['private'] == Item::PRIVATE) || ($b['created'] !== $b['edited'])) {
return;
Expand All @@ -210,14 +209,14 @@ function diaspora_send(array &$b)
return;
}

Logger::info('diaspora_send: prepare posting');
DI::logger()->info('diaspora_send: prepare posting');

$handle = DI::pConfig()->get($b['uid'], 'diaspora', 'handle');
$password = DI::pConfig()->get($b['uid'], 'diaspora', 'password');
$aspect = DI::pConfig()->get($b['uid'], 'diaspora', 'aspect');

if ($handle && $password) {
Logger::info('diaspora_send: all values seem to be okay');
DI::logger()->info('diaspora_send: all values seem to be okay');

$title = $b['title'];
$body = $b['body'];
Expand Down Expand Up @@ -248,20 +247,20 @@ function diaspora_send(array &$b)
require_once "addon/diaspora/diasphp.php";

try {
Logger::info('diaspora_send: prepare');
DI::logger()->info('diaspora_send: prepare');
$conn = new Diaspora_Connection($handle, $password);
Logger::info('diaspora_send: try to log in ' . $handle);
DI::logger()->info('diaspora_send: try to log in ' . $handle);
$conn->logIn();
Logger::info('diaspora_send: try to send ' . $body);
DI::logger()->info('diaspora_send: try to send ' . $body);

$conn->provider = $hostname;
$conn->postStatusMessage($body, $aspect);

Logger::notice('diaspora_send: success');
DI::logger()->notice('diaspora_send: success');
} catch (Exception $e) {
Logger::notice("diaspora_send: Error submitting the post: " . $e->getMessage());
DI::logger()->notice("diaspora_send: Error submitting the post: " . $e->getMessage());

Logger::info('diaspora_send: requeueing ' . $b['uid']);
DI::logger()->info('diaspora_send: requeueing ' . $b['uid']);

Worker::defer();
}
Expand Down

0 comments on commit 4881e60

Please sign in to comment.