mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-09 20:11:22 +00:00
Add audit logging.
This commit is contained in:
28
app/Support/Logging/AuditProcessor.php
Normal file
28
app/Support/Logging/AuditProcessor.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Support\Logging;
|
||||
|
||||
/**
|
||||
* Class AuditProcessor
|
||||
*/
|
||||
class AuditProcessor
|
||||
{
|
||||
/**
|
||||
* @param array $record
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function __invoke(array $record): array
|
||||
{
|
||||
$record['extra']['path'] = request()->method() . ':' . request()->url();
|
||||
|
||||
$record['extra']['IP'] = app('request')->ip();
|
||||
if (auth()->check()) {
|
||||
$record['extra']['user'] = auth()->user()->email;
|
||||
}
|
||||
|
||||
|
||||
return $record;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user