mirror of
https://github.com/friendica/friendica
synced 2025-05-09 15:04:10 +02:00
Add Monolog
This commit is contained in:
parent
1d61645a16
commit
fe8f0e0045
15 changed files with 363 additions and 121 deletions
48
src/App/FriendicaLoggerProcessor.php
Normal file
48
src/App/FriendicaLoggerProcessor.php
Normal file
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\App;
|
||||
|
||||
use Monolog\Processor\ProcessorInterface;
|
||||
|
||||
/**
|
||||
* Includes the Friendica specific process_id of "app->process_id"
|
||||
*
|
||||
* @package Friendica\App
|
||||
*/
|
||||
class FriendicaLoggerProcessor implements ProcessorInterface
|
||||
{
|
||||
/**
|
||||
* @var string the ID of the current Friendica process
|
||||
*/
|
||||
private $processId = null;
|
||||
|
||||
/**
|
||||
* Set the process id based on the Application instance
|
||||
*
|
||||
* @param string $processId the process id
|
||||
*/
|
||||
public function setProcessId($processId)
|
||||
{
|
||||
if (!isset($this->processId) || $this->processId == '')
|
||||
{
|
||||
$this->processId = $processId;
|
||||
}
|
||||
}
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->processId = session_id();
|
||||
}
|
||||
|
||||
public function __invoke(array $records)
|
||||
{
|
||||
$records['extra'] = array_merge(
|
||||
$records['extra'],
|
||||
[
|
||||
'app_id' => $this->processId,
|
||||
]
|
||||
);
|
||||
|
||||
return $records;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue