Base64 encode logs

This commit is contained in:
James Cole
2024-01-01 15:24:15 +01:00
parent 4bed30347d
commit 2ede3b420b
2 changed files with 10 additions and 16 deletions

View File

@@ -33,7 +33,6 @@ use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\View\View; use Illuminate\Contracts\View\View;
use Illuminate\Http\RedirectResponse; use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
/** /**
@@ -76,7 +75,7 @@ class EditController extends Controller
$billPeriods = config('firefly.bill_periods'); $billPeriods = config('firefly.bill_periods');
foreach ($billPeriods as $current) { foreach ($billPeriods as $current) {
$periods[$current] = (string) trans('firefly.' . $current); $periods[$current] = (string) trans('firefly.'.$current);
} }
$subTitle = (string) trans('firefly.edit_bill', ['name' => $bill->name]); $subTitle = (string) trans('firefly.edit_bill', ['name' => $bill->name]);
@@ -148,6 +147,4 @@ class EditController extends Controller
return $redirect; return $redirect;
} }
} }

View File

@@ -122,23 +122,20 @@ abstract class Controller extends BaseController
); );
} }
/**
* @param array|null $files
*
* @return void
*/
protected function auditLogAttachmentInfo(?array $files): void protected function auditLogAttachmentInfo(?array $files): void
{ {
if (null === $files) { if (null === $files) {
Log::channel('audit')->info('No files found'); Log::channel('audit')->info('No files found');
return; return;
} }
/** /**
* @var int $index * @var int $index
* @var UploadedFile $file * @var UploadedFile $file
*/ */
foreach ($files as $index => $file) { foreach ($files as $index => $file) {
Log::channel('audit')->info(sprintf('File [%d/%d] upload attachment "%s", content is: "%s".', $index + 1, count($files), $file->getClientOriginalName(), $file->getContent())); Log::channel('audit')->info(sprintf('File [%d/%d] upload attachment "%s", content is: "%s".', $index + 1, count($files), $file->getClientOriginalName(),base64_encode($file->getContent())));
} }
} }
} }