Skip to content

Commit

Permalink
Merge pull request #845 from catalyst/839-fix-error-logger-update-mon…
Browse files Browse the repository at this point in the history
…olog-php

Fix fatal error issue #839
  • Loading branch information
gbarat87 authored Oct 20, 2023
2 parents cb138aa + 6ef8c4a commit 68c9e26
Show file tree
Hide file tree
Showing 1,742 changed files with 50,254 additions and 85,166 deletions.
19 changes: 16 additions & 3 deletions classes/local/execution/logging/mtrace_handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
namespace tool_dataflows\local\execution\logging;

use Monolog\Handler\AbstractHandler;
use Monolog\Handler\AbstractProcessingHandler;

/**
* An environment for logging information about dataflow execution.
Expand All @@ -26,17 +27,29 @@
* @copyright Catalyst IT, 2023
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class mtrace_handler extends AbstractHandler {
class mtrace_handler extends AbstractProcessingHandler {

/**
* Default handler for Moodle.
*
* @param array $record the log record
**/
public function handle(array $record) {
public function handle(array $record): bool {
if ($this->isHandling($record)) {
$record['formatted'] = trim($this->getFormatter()->format($record));
mtrace($record['formatted']);
$this->write($record);
return true;
}
return $this->handler->handle($record);
}

/**
* Writes the record down to the log of the implementing handler
*
* @param array $record
* @return void
*/
protected function write(array $record): void {
mtrace($record['formatted']);
}
}
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"config": {
"platform": {
"php": "7.1"
"php": "7.4"
}
},
"require": {
"php": ">=7.1",
"php": ">=7.4",
"symfony/yaml": "^3.4",
"symfony/expression-language": "^3.4",
"phpseclib/phpseclib": "~3.0",
Expand Down
Loading

0 comments on commit 68c9e26

Please sign in to comment.