Replace log.

This commit is contained in:
James Cole
2025-10-05 12:49:39 +02:00
parent 362705ec71
commit 072212c112
39 changed files with 194 additions and 195 deletions

View File

@@ -34,6 +34,7 @@ use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use Illuminate\Console\Command;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
class CorrectsOpeningBalanceCurrencies extends Command
{
@@ -78,7 +79,7 @@ class CorrectsOpeningBalanceCurrencies extends Command
$account = $this->getAccount($journal);
if (!$account instanceof Account) {
$message = sprintf('Transaction journal #%d has no valid account. Can\'t fix this line.', $journal->id);
app('log')->warning($message);
Log::warning($message);
$this->friendlyError($message);
return 0;

View File

@@ -28,6 +28,7 @@ use FireflyIII\Console\Commands\ShowsFriendlyMessages;
use FireflyIII\Enums\TransactionTypeEnum;
use FireflyIII\Models\TransactionJournal;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Log;
class CorrectsTransferBudgets extends Command
{
@@ -53,13 +54,13 @@ class CorrectsTransferBudgets extends Command
foreach ($set as $entry) {
$message = sprintf('Transaction journal #%d is a %s, so has no longer a budget.', $entry->id, $entry->transactionType->type);
$this->friendlyInfo($message);
app('log')->debug($message);
Log::debug($message);
$entry->budgets()->sync([]);
++$count;
}
if (0 !== $count) {
$message = sprintf('Corrected %d invalid budget/journal entries (entry).', $count);
app('log')->debug($message);
Log::debug($message);
$this->friendlyInfo($message);
}

View File

@@ -152,7 +152,7 @@ class CorrectsUnevenAmount extends Command
$entry->the_sum
);
$this->friendlyWarning($message);
app('log')->warning($message);
Log::warning($message);
++$this->count;
continue;
@@ -230,7 +230,7 @@ class CorrectsUnevenAmount extends Command
$message = sprintf('Sum of journal #%d is not zero, journal is broken and now fixed.', $journal->id);
$this->friendlyWarning($message);
app('log')->warning($message);
Log::warning($message);
$destination->amount = $amount;
$destination->save();

View File

@@ -30,6 +30,7 @@ use FireflyIII\Models\TransactionJournal;
use Illuminate\Console\Command;
use Illuminate\Database\QueryException;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class RemovesEmptyJournals extends Command
{
@@ -68,8 +69,8 @@ class RemovesEmptyJournals extends Command
$journal = TransactionJournal::find($row->transaction_journal_id);
$journal?->delete();
} catch (QueryException $e) {
app('log')->info(sprintf('Could not delete journal: %s', $e->getMessage()));
app('log')->error($e->getTraceAsString());
Log::info(sprintf('Could not delete journal: %s', $e->getMessage()));
Log::error($e->getTraceAsString());
}
Transaction::where('transaction_journal_id', $row->transaction_journal_id)->delete();
@@ -96,8 +97,8 @@ class RemovesEmptyJournals extends Command
$journal = TransactionJournal::find($entry->id);
$journal?->delete();
} catch (QueryException $e) {
app('log')->info(sprintf('Could not delete entry: %s', $e->getMessage()));
app('log')->error($e->getTraceAsString());
Log::info(sprintf('Could not delete entry: %s', $e->getMessage()));
Log::error($e->getTraceAsString());
}
$this->friendlyInfo(sprintf('Deleted empty transaction journal #%d', $entry->id));