Replace references to log service.

This commit is contained in:
James Cole
2025-11-02 14:48:36 +01:00
parent ae767fc90d
commit 7743d16ea1
19 changed files with 60 additions and 47 deletions

View File

@@ -36,6 +36,7 @@ use FireflyIII\Support\Http\Api\ExchangeRateConverter;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
/**
* Class AccountObserver
*/
@@ -75,7 +76,7 @@ class AccountObserver
*/
public function deleting(Account $account): void
{
app('log')->debug('Observe "deleting" of an account.');
Log::debug('Observe "deleting" of an account.');
$repository = app(AttachmentRepositoryInterface::class);
$repository->setUser($account->user);

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Handlers\Observer;
use FireflyIII\Models\Attachment;
use Illuminate\Support\Facades\Log;
/**
* Class AttachmentObserver
@@ -32,7 +33,7 @@ class AttachmentObserver
{
public function deleting(Attachment $attachment): void
{
app('log')->debug('Observe "deleting" of an attachment.');
Log::debug('Observe "deleting" of an attachment.');
$attachment->notes()->delete();
}
}

View File

@@ -30,6 +30,7 @@ use FireflyIII\Support\Facades\Amount;
use FireflyIII\Support\Http\Api\ExchangeRateConverter;
use Illuminate\Support\Facades\Log;
/**
* Class BillObserver
*/
@@ -65,7 +66,7 @@ class BillObserver
$repository = app(AttachmentRepositoryInterface::class);
$repository->setUser($bill->user);
// app('log')->debug('Observe "deleting" of a bill.');
// Log::debug('Observe "deleting" of a bill.');
/** @var Attachment $attachment */
foreach ($bill->attachments()->get() as $attachment) {
$repository->destroy($attachment);

View File

@@ -26,6 +26,7 @@ namespace FireflyIII\Handlers\Observer;
use FireflyIII\Models\Attachment;
use FireflyIII\Models\Category;
use FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface;
use Illuminate\Support\Facades\Log;
/**
* Class CategoryObserver
@@ -34,7 +35,7 @@ class CategoryObserver
{
public function deleting(Category $category): void
{
app('log')->debug('Observe "deleting" of a category.');
Log::debug('Observe "deleting" of a category.');
$repository = app(AttachmentRepositoryInterface::class);
$repository->setUser($category->user);

View File

@@ -30,6 +30,7 @@ use FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface;
use FireflyIII\Support\Http\Api\ExchangeRateConverter;
use Illuminate\Support\Facades\Log;
/**
* Class PiggyBankObserver
*/
@@ -66,7 +67,7 @@ class PiggyBankObserver
*/
public function deleting(PiggyBank $piggyBank): void
{
app('log')->debug('Observe "deleting" of a piggy bank.');
Log::debug('Observe "deleting" of a piggy bank.');
$repository = app(AttachmentRepositoryInterface::class);
$repository->setUser($piggyBank->accounts()->first()->user);

View File

@@ -26,6 +26,7 @@ namespace FireflyIII\Handlers\Observer;
use FireflyIII\Models\Attachment;
use FireflyIII\Models\Recurrence;
use FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface;
use Illuminate\Support\Facades\Log;
/**
* Class RecurrenceObserver
@@ -34,7 +35,7 @@ class RecurrenceObserver
{
public function deleting(Recurrence $recurrence): void
{
app('log')->debug('Observe "deleting" of a recurrence.');
Log::debug('Observe "deleting" of a recurrence.');
$repository = app(AttachmentRepositoryInterface::class);
$repository->setUser($recurrence->user);

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Handlers\Observer;
use FireflyIII\Models\RecurrenceTransaction;
use Illuminate\Support\Facades\Log;
/**
* Class RecurrenceTransactionObserver
@@ -32,7 +33,7 @@ class RecurrenceTransactionObserver
{
public function deleting(RecurrenceTransaction $transaction): void
{
app('log')->debug('Observe "deleting" of a recurrence transaction.');
Log::debug('Observe "deleting" of a recurrence transaction.');
$transaction->recurrenceTransactionMeta()->delete();
}
}

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Handlers\Observer;
use FireflyIII\Models\RuleGroup;
use Illuminate\Support\Facades\Log;
/**
* Class RuleGroupObserver
@@ -32,7 +33,7 @@ class RuleGroupObserver
{
public function deleting(RuleGroup $ruleGroup): void
{
app('log')->debug('Observe "deleting" of a rule group.');
Log::debug('Observe "deleting" of a rule group.');
foreach ($ruleGroup->rules()->get() as $rule) {
$rule->delete();
}

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Handlers\Observer;
use FireflyIII\Models\Rule;
use Illuminate\Support\Facades\Log;
/**
* Class RuleObserver
@@ -32,7 +33,7 @@ class RuleObserver
{
public function deleting(Rule $rule): void
{
app('log')->debug('Observe "deleting" of a rule.');
Log::debug('Observe "deleting" of a rule.');
$rule->ruleActions()->delete();
$rule->ruleTriggers()->delete();
}

View File

@@ -26,6 +26,7 @@ namespace FireflyIII\Handlers\Observer;
use FireflyIII\Models\Attachment;
use FireflyIII\Models\Tag;
use FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface;
use Illuminate\Support\Facades\Log;
/**
* Class TagObserver
@@ -34,7 +35,7 @@ class TagObserver
{
public function deleting(Tag $tag): void
{
app('log')->debug('Observe "deleting" of a tag.');
Log::debug('Observe "deleting" of a tag.');
$repository = app(AttachmentRepositoryInterface::class);
$repository->setUser($tag->user);

View File

@@ -77,7 +77,7 @@ class TransactionObserver
public function deleting(?Transaction $transaction): void
{
app('log')->debug('Observe "deleting" of a transaction.');
Log::debug('Observe "deleting" of a transaction.');
$transaction?->transactionJournal?->delete();
}

View File

@@ -24,7 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Handlers\Observer;
use FireflyIII\Models\WebhookMessage;
use Illuminate\Support\Facades\Log;
/**
* Class WebhookMessageObserver
*/
@@ -32,7 +32,7 @@ class WebhookMessageObserver
{
public function deleting(WebhookMessage $webhookMessage): void
{
app('log')->debug('Observe "deleting" of a webhook message.');
Log::debug('Observe "deleting" of a webhook message.');
$webhookMessage->webhookAttempts()->delete();
}
}

View File

@@ -24,7 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Handlers\Observer;
use FireflyIII\Models\Webhook;
use Illuminate\Support\Facades\Log;
/**
* Class WebhookObserver
*/
@@ -32,7 +32,7 @@ class WebhookObserver
{
public function deleting(Webhook $webhook): void
{
app('log')->debug('Observe "deleting" of a webhook.');
Log::debug('Observe "deleting" of a webhook.');
foreach ($webhook->webhookMessages()->get() as $message) {
$message->delete();
}

View File

@@ -130,7 +130,7 @@ trait AccountCollection
$this->query->whereNotIn('source.account_id', $accountIds);
$this->query->whereNotIn('destination.account_id', $accountIds);
app('log')->debug(sprintf('GroupCollector: excludeAccounts: %s', implode(', ', $accountIds)));
Log::debug(sprintf('GroupCollector: excludeAccounts: %s', implode(', ', $accountIds)));
}
return $this;
@@ -145,7 +145,7 @@ trait AccountCollection
$accountIds = $accounts->pluck('id')->toArray();
$this->query->whereNotIn('destination.account_id', $accountIds);
app('log')->debug(sprintf('GroupCollector: excludeDestinationAccounts: %s', implode(', ', $accountIds)));
Log::debug(sprintf('GroupCollector: excludeDestinationAccounts: %s', implode(', ', $accountIds)));
}
return $this;
@@ -160,7 +160,7 @@ trait AccountCollection
$accountIds = $accounts->pluck('id')->toArray();
$this->query->whereNotIn('source.account_id', $accountIds);
app('log')->debug(sprintf('GroupCollector: excludeSourceAccounts: %s', implode(', ', $accountIds)));
Log::debug(sprintf('GroupCollector: excludeSourceAccounts: %s', implode(', ', $accountIds)));
}
return $this;
@@ -179,7 +179,7 @@ trait AccountCollection
$query->orWhereIn('destination.account_id', $accountIds);
}
);
// app('log')->debug(sprintf('GroupCollector: setAccounts: %s', implode(', ', $accountIds)));
// Log::debug(sprintf('GroupCollector: setAccounts: %s', implode(', ', $accountIds)));
}
return $this;
@@ -198,7 +198,7 @@ trait AccountCollection
$query->whereIn('destination.account_id', $accountIds);
}
);
app('log')->debug(sprintf('GroupCollector: setBothAccounts: %s', implode(', ', $accountIds)));
Log::debug(sprintf('GroupCollector: setBothAccounts: %s', implode(', ', $accountIds)));
}
return $this;
@@ -213,7 +213,7 @@ trait AccountCollection
$accountIds = $accounts->pluck('id')->toArray();
$this->query->whereIn('destination.account_id', $accountIds);
app('log')->debug(sprintf('GroupCollector: setDestinationAccounts: %s', implode(', ', $accountIds)));
Log::debug(sprintf('GroupCollector: setDestinationAccounts: %s', implode(', ', $accountIds)));
}
return $this;
@@ -232,7 +232,7 @@ trait AccountCollection
$query->whereNotIn('destination.account_id', $accountIds);
}
);
// app('log')->debug(sprintf('GroupCollector: setAccounts: %s', implode(', ', $accountIds)));
// Log::debug(sprintf('GroupCollector: setAccounts: %s', implode(', ', $accountIds)));
}
return $this;
@@ -247,7 +247,7 @@ trait AccountCollection
$accountIds = $accounts->pluck('id')->toArray();
$this->query->whereIn('source.account_id', $accountIds);
app('log')->debug(sprintf('GroupCollector: setSourceAccounts: %s', implode(', ', $accountIds)));
Log::debug(sprintf('GroupCollector: setSourceAccounts: %s', implode(', ', $accountIds)));
}
return $this;
@@ -280,7 +280,7 @@ trait AccountCollection
}
);
app('log')->debug(sprintf('GroupCollector: setXorAccounts: %s', implode(', ', $accountIds)));
Log::debug(sprintf('GroupCollector: setXorAccounts: %s', implode(', ', $accountIds)));
}
return $this;

View File

@@ -29,7 +29,7 @@ use FireflyIII\Models\Attachment;
use FireflyIII\Models\TransactionJournal;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
use Illuminate\Support\Facades\Log;
/**
* Trait AttachmentCollection
*/
@@ -72,7 +72,7 @@ trait AttachmentCollection
*/
public function hasAttachments(): GroupCollectorInterface
{
app('log')->debug('Add filter on attachment ID.');
Log::debug('Add filter on attachment ID.');
$this->joinAttachmentTables();
$this->query->whereNotNull('attachments.attachable_id');
$this->query->whereNull('attachments.deleted_at');
@@ -510,7 +510,7 @@ trait AttachmentCollection
*/
public function hasNoAttachments(): GroupCollectorInterface
{
app('log')->debug('Add filter on no attachments.');
Log::debug('Add filter on no attachments.');
$this->joinAttachmentTables();
$this->query->where(static function (Builder $q1): void { // @phpstan-ignore-line

View File

@@ -320,8 +320,8 @@ class GroupCollector implements GroupCollectorInterface
public function dumpQueryInLogs(): void
{
app('log')->debug($this->query->select($this->fields)->toSql());
app('log')->debug('Bindings', $this->query->getBindings());
Log::debug($this->query->select($this->fields)->toSql());
Log::debug('Bindings', $this->query->getBindings());
}
/**
@@ -590,7 +590,7 @@ class GroupCollector implements GroupCollectorInterface
$result['created_at']->setTimezone(config('app.timezone'));
$result['updated_at']->setTimezone(config('app.timezone'));
} catch (Exception $e) { // intentional generic exception
app('log')->error($e->getMessage());
Log::error($e->getMessage());
throw new FireflyException($e->getMessage(), 0, $e);
}
@@ -621,7 +621,7 @@ class GroupCollector implements GroupCollectorInterface
try {
$tagDate = Carbon::parse($augumentedJournal['tag_date']);
} catch (InvalidFormatException $e) {
app('log')->debug(sprintf('Could not parse date: %s', $e->getMessage()));
Log::debug(sprintf('Could not parse date: %s', $e->getMessage()));
}
$result['tags'][$tagId] = [
@@ -697,7 +697,7 @@ class GroupCollector implements GroupCollectorInterface
try {
$tagDate = Carbon::parse($newArray['tag_date']);
} catch (InvalidFormatException $e) {
app('log')->debug(sprintf('Could not parse date: %s', $e->getMessage()));
Log::debug(sprintf('Could not parse date: %s', $e->getMessage()));
}
$existingJournal['tags'][$tagId] = [
@@ -783,13 +783,13 @@ class GroupCollector implements GroupCollectorInterface
if (0 === $countFilters) {
return $currentCollection;
}
app('log')->debug(sprintf('GroupCollector: postFilterCollection has %d filter(s) and %d transaction(s).', count($this->postFilters), count($currentCollection)));
Log::debug(sprintf('GroupCollector: postFilterCollection has %d filter(s) and %d transaction(s).', count($this->postFilters), count($currentCollection)));
/**
* @var Closure $function
*/
foreach ($this->postFilters as $function) {
app('log')->debug('Applying filter...');
Log::debug('Applying filter...');
$nextCollection = new Collection();
// loop everything in the current collection
@@ -814,7 +814,7 @@ class GroupCollector implements GroupCollectorInterface
}
}
$currentCollection = $nextCollection;
app('log')->debug(sprintf('GroupCollector: postFilterCollection has %d transaction(s) left.', count($currentCollection)));
Log::debug(sprintf('GroupCollector: postFilterCollection has %d transaction(s) left.', count($currentCollection)));
}
return $currentCollection;
@@ -875,7 +875,7 @@ class GroupCollector implements GroupCollectorInterface
public function setLimit(int $limit): GroupCollectorInterface
{
$this->limit = $limit;
// app('log')->debug(sprintf('GroupCollector: The limit is now %d', $limit));
// Log::debug(sprintf('GroupCollector: The limit is now %d', $limit));
return $this;
}
@@ -973,7 +973,7 @@ class GroupCollector implements GroupCollectorInterface
{
$page = 0 === $page ? 1 : $page;
$this->page = $page;
// app('log')->debug(sprintf('GroupCollector: page is now %d', $page));
// Log::debug(sprintf('GroupCollector: page is now %d', $page));
return $this;
}
@@ -1066,7 +1066,7 @@ class GroupCollector implements GroupCollectorInterface
*/
private function startQuery(): void
{
// app('log')->debug('GroupCollector::startQuery');
// Log::debug('GroupCollector::startQuery');
$this->query = $this->user
// ->transactionGroups()
// ->leftJoin('transaction_journals', 'transaction_journals.transaction_group_id', 'transaction_groups.id')
@@ -1126,7 +1126,7 @@ class GroupCollector implements GroupCollectorInterface
*/
private function startQueryForGroup(): void
{
// app('log')->debug('GroupCollector::startQuery');
// Log::debug('GroupCollector::startQuery');
$this->query = $this->userGroup
->transactionJournals()
->leftJoin('transaction_groups', 'transaction_journals.transaction_group_id', 'transaction_groups.id')

View File

@@ -27,6 +27,7 @@ use Carbon\Carbon;
use FireflyIII\Support\Facades\Preferences;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use Illuminate\Support\Facades\Log;
/**
* Class FiscalHelper.
@@ -49,7 +50,7 @@ class FiscalHelper implements FiscalHelperInterface
*/
public function endOfFiscalYear(Carbon $date): Carbon
{
// app('log')->debug(sprintf('Now in endOfFiscalYear(%s).', $date->format('Y-m-d')));
// Log::debug(sprintf('Now in endOfFiscalYear(%s).', $date->format('Y-m-d')));
$endDate = $this->startOfFiscalYear($date);
if (true === $this->useCustomFiscalYear) {
// add 1 year and sub 1 day
@@ -59,7 +60,7 @@ class FiscalHelper implements FiscalHelperInterface
if (false === $this->useCustomFiscalYear) {
$endDate->endOfYear();
}
// app('log')->debug(sprintf('Result of endOfFiscalYear(%s) = %s', $date->format('Y-m-d'), $endDate->format('Y-m-d')));
// Log::debug(sprintf('Result of endOfFiscalYear(%s) = %s', $date->format('Y-m-d'), $endDate->format('Y-m-d')));
return $endDate;
}
@@ -92,7 +93,7 @@ class FiscalHelper implements FiscalHelperInterface
$startDate->startOfYear();
}
// app('log')->debug(sprintf('Result of startOfFiscalYear(%s) = %s', $date->format('Y-m-d'), $startDate->format('Y-m-d')));
// Log::debug(sprintf('Result of startOfFiscalYear(%s) = %s', $date->format('Y-m-d'), $startDate->format('Y-m-d')));
return $startDate;
}

View File

@@ -25,6 +25,7 @@ declare(strict_types=1);
namespace FireflyIII\Helpers\Update;
use FireflyIII\Services\FireflyIIIOrg\Update\UpdateRequestInterface;
use Illuminate\Support\Facades\Log;
/**
* Trait UpdateTrait
@@ -38,7 +39,7 @@ trait UpdateTrait
*/
public function getLatestRelease(): array
{
app('log')->debug('Now in getLatestRelease()');
Log::debug('Now in getLatestRelease()');
/** @var UpdateRequestInterface $checker */
$checker = app(UpdateRequestInterface::class);

View File

@@ -30,6 +30,7 @@ use FireflyIII\Models\WebhookMessage;
use JsonException;
use function Safe\json_encode;
use Illuminate\Support\Facades\Log;
/**
* Class Sha3SignatureGenerator
@@ -52,10 +53,10 @@ class Sha3SignatureGenerator implements SignatureGeneratorInterface
try {
$json = json_encode($message->message, JSON_THROW_ON_ERROR);
} catch (JsonException $e) {
app('log')->error('Could not generate hash.');
app('log')->error(sprintf('JSON value: %s', $json));
app('log')->error($e->getMessage());
app('log')->error($e->getTraceAsString());
Log::error('Could not generate hash.');
Log::error(sprintf('JSON value: %s', $json));
Log::error($e->getMessage());
Log::error($e->getTraceAsString());
throw new FireflyException('Could not generate JSON for SHA3 hash.', 0, $e);
}