Skip to content

Commit 770c016

Browse files
Properly parse new log format with dedicated exception field
Signed-off-by: Julius Härtl <[email protected]> Signed-off-by: npmbuildbot-nextcloud[bot] <npmbuildbot-nextcloud[bot]@users.noreply.github.com>
1 parent 80aaa70 commit 770c016

File tree

7 files changed

+17
-15
lines changed

7 files changed

+17
-15
lines changed

build/main.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/main.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/Components/LogEntry.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,24 @@ export class LogEntry extends Component {
2727
}
2828

2929
renderException () {
30-
var exceptionData = this.exceptionParser.parse(this.props.message);
30+
var exceptionData = this.exceptionParser.parse(this.props.exception ?? this.props.message);
3131
return (
3232
<Exception {...exceptionData}/>
3333
);
3434
}
3535

3636
renderBackgroundException () {
37-
var exceptionData = this.exceptionParser.parse(this.props.message);
37+
var exceptionData = this.exceptionParser.parse(this.props.exception ?? this.props.message);
3838
return (
3939
<BackgroundException {...exceptionData}/>
4040
);
4141
}
4242

4343
isBackgroundJobException () {
44-
return this.exceptionParser.isBackgroundJobException(this.props.message);
44+
return this.exceptionParser.isBackgroundJobException(this.props.exception ?? this.props.message);
4545
}
4646

4747
isException () {
48-
return this.exceptionParser.isException(this.props.message);
48+
return this.exceptionParser.isException(this.props.exception ?? this.props.message);
4949
}
5050
}

js/Components/LogTable.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export class LogTable extends Component {
7070
</td>
7171
<td className={style.app}>{entry.app}</td>
7272
<td className={style.message}><LogEntry
73-
message={entry.message}/></td>
73+
message={entry.message} exception={entry.exception}/></td>
7474
<td className={style.copy}>
7575
<button title={t('logreader', 'Copy')}
7676
className="icon icon-clippy" onClick={() => {
@@ -118,7 +118,7 @@ export class LogTable extends Component {
118118
className={timeClass + ' ' + style.column}>{this.formatDate(entry, this.props.relative)}</div>
119119
<div className={style.message + ' ' + style.column}>
120120
<LogEntry
121-
message={entry.message}/></div>
121+
message={entry.message} exception={entry.exception}/></div>
122122
</div>
123123
)
124124
});

lib/Command/Tail.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
7373
$tableItems[] = [
7474
self::LEVELS[$logItem['level']],
7575
wordwrap($logItem['app'], 18),
76-
$this->formatter->formatMessage($logItem['message'], $messageWidth) . "\n",
76+
$this->formatter->formatMessage($logItem, $messageWidth) . "\n",
7777
$logItem['time']
7878
];
7979
}

lib/Command/Watch.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ private function printItem(array $logItem, OutputInterface $output, int $message
111111
$parts = [
112112
self::LEVELS[$logItem['level']],
113113
wordwrap($logItem['app'], 18),
114-
$this->formatter->formatMessage($logItem['message'], $messageWidth),
114+
$this->formatter->formatMessage($logItem, $messageWidth),
115115
$logItem['time'],
116116
];
117117

lib/Log/Formatter.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,14 @@ public function __construct(string $root) {
3030
$this->root = $root;
3131
}
3232

33-
public function formatMessage($message, int $width) {
34-
if (is_array($message) && isset($message['Exception'])) {
35-
return $this->formatException($message, $width);
36-
} else {
37-
return wordwrap($message, $width);
33+
public function formatMessage($logItem, int $width) {
34+
if (isset($logItem['exception'])) {
35+
return $this->formatException($logItem['exception'], $width);
36+
}
37+
if (is_array($logItem['message']) && isset($logItem['message']['Exception'])) {
38+
return $this->formatException($logItem['message'], $width);
3839
}
40+
return wordwrap($logItem['message'], $width);
3941
}
4042

4143
private function formatException(array $e, int $width) {

0 commit comments

Comments
 (0)