Handle and display multiline log messages correctly
This commit is contained in:
parent
ec82b3bc09
commit
7c0be30def
|
@ -44,14 +44,12 @@ class ListController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->addTitleTab('application log');
|
$this->addTitleTab('application log');
|
||||||
$pattern = '/^(?<datetime>[0-9]{4}(-[0-9]{2}){2}' // date
|
|
||||||
. 'T[0-9]{2}(:[0-9]{2}){2}([\\+\\-][0-9]{2}:[0-9]{2})?)' // time
|
|
||||||
. ' - (?<loglevel>[A-Za-z]+)' // loglevel
|
|
||||||
. ' - (?<message>.*)$/';
|
|
||||||
|
|
||||||
$resource = new FileReader(new ConfigObject(array(
|
$resource = new FileReader(new ConfigObject(array(
|
||||||
'filename' => Config::app()->get('logging', 'file'),
|
'filename' => Config::app()->get('logging', 'file'),
|
||||||
'fields' => $pattern
|
'fields' => '/(?<!.)(?<datetime>[0-9]{4}(?:-[0-9]{2}){2}' // date
|
||||||
|
. 'T[0-9]{2}(?::[0-9]{2}){2}(?:[\+\-][0-9]{2}:[0-9]{2})?)' // time
|
||||||
|
. ' - (?<loglevel>[A-Za-z]+) - (?<message>.*)(?!.)/msS' // loglevel, message
|
||||||
)));
|
)));
|
||||||
$this->view->logData = $resource->select()->order('DESC')->paginate();
|
$this->view->logData = $resource->select()->order('DESC')->paginate();
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
<?= $this->escape($value->loglevel) ?>
|
<?= $this->escape($value->loglevel) ?>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<?= $this->escape($value->message) ?>
|
<?= nl2br($this->escape($value->message), false) ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
|
|
@ -58,7 +58,7 @@ class FileReader implements Selectable, Countable
|
||||||
*/
|
*/
|
||||||
public function iterate()
|
public function iterate()
|
||||||
{
|
{
|
||||||
return new FileIterator($this->filename, $this->fields);
|
return new LogFileIterator($this->filename, $this->fields);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue