Merge pull request #7075 from firefly-iii/six

Fix audit processor
This commit is contained in:
James Cole 2023-02-24 06:04:04 +01:00 committed by GitHub
commit 3832297d69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,6 +24,8 @@ declare(strict_types=1);
namespace FireflyIII\Support\Logging;
use Monolog\LogRecord;
/**
* Class AuditProcessor
*
@ -32,14 +34,14 @@ namespace FireflyIII\Support\Logging;
class AuditProcessor
{
/**
* @param array $record
* @param LogRecord $record
*
* @return array
* @return LogRecord
*/
public function __invoke(array $record): array
public function __invoke(LogRecord $record): LogRecord
{
if (auth()->check()) {
$record['message'] = sprintf(
$message = sprintf(
'AUDIT: %s (%s (%s) -> %s:%s)',
$record['message'],
app('request')->ip(),
@ -47,11 +49,10 @@ class AuditProcessor
request()->method(),
request()->url()
);
return $record;
return new LogRecord($record->datetime, $record->channel, $record->level, $message, $record->context, $record->extra, $record->formatted);
}
$record['message'] = sprintf(
$message = sprintf(
'AUDIT: %s (%s -> %s:%s)',
$record['message'],
app('request')->ip(),
@ -59,6 +60,6 @@ class AuditProcessor
request()->url()
);
return $record;
return new LogRecord($record->datetime, $record->channel, $record->level, $message, $record->context, $record->extra, $record->formatted);
}
}