Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrap lines in log messages with line feeds #2967

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions bundles/org.openhab.ui/web/src/pages/developer/log-viewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,8 @@
:class="{ 'disabled-link': !stateConnected || !stateProcessing, 'no-margin-left': $device.ios }"
@click="loggingPause" />
<f7-link icon-ios="f7:stop_fill" icon-aurora="f7:stop_fill" icon-md="material:stop_fill"
:icon-color="!stateConnected ? 'gray' : ''"
:tooltip="!$device.ios ? 'Stop receiving logs' : ''"
:class="{ 'disabled-link': !stateConnected, 'no-margin-left': $device.ios }"
@click="loggingStop" />
:icon-color="!stateConnected ? 'gray' : ''" :tooltip="!$device.ios ? 'Stop receiving logs' : ''"
:class="{ 'disabled-link': !stateConnected, 'no-margin-left': $device.ios }" @click="loggingStop" />
</f7-nav-right>

<f7-subnavbar :inner="false" style="padding-right: var(--f7-safe-area-right)">
Expand Down Expand Up @@ -158,8 +156,8 @@
:class="{ 'disabled-link': filterCount == 0 }" @click="downloadCSV" />
<f7-link icon-f7="rectangle_on_rectangle" tooltip="Copy filtered log to clipboard"
:class="{ 'disabled-link': filterCount == 0 }" @click="copyTableToClipboard" />
<f7-link icon-f7="trash" tooltip="Clear the log buffer"
:class="{ 'disabled-link': tableData.length == 0 }" @click="clearLog" />
<f7-link icon-f7="trash" tooltip="Clear the log buffer" :class="{ 'disabled-link': tableData.length == 0 }"
@click="clearLog" />
<f7-link @click="toggleErrorDisplay" tooltip="Always show error level logs">
<f7-icon v-if="showErrors" f7="exclamationmark_triangle_fill" />
<f7-icon v-else f7="exclamationmark_triangle" />
Expand Down Expand Up @@ -220,7 +218,7 @@
table-layout auto

td.nowrap
padding 5px
padding 0px
text-align left
white-space nowrap

Expand All @@ -233,6 +231,7 @@

tr.table-rows
height 31px
vertical-align top

tr.error
background-color rgb(255, 96, 96)
Expand Down Expand Up @@ -486,7 +485,7 @@ export default {
milliseconds: ms,
level: logEntry.level.toUpperCase(),
loggerName: logEntry.loggerName,
message: logEntry.message
message: logEntry.message.replace(/\n/g, '<br>')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add some indentation here as well, for example 2 spaces.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've not looked at a "real" stack trace - doesn't it have tabs (or whitespace of some description) after the break. In theory it should render with some indentation.

While I understand your thinking, I'm a little hesitant to add "random" indentation. In principal, this isn't stack trace specific - it should (IMHO) faithfully represent whatever was received in the logger message - so if the message has indentation, then we should also have some, but if not, we shouldn't add any extra (IMHO).

WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've not looked at a "real" stack trace - doesn't it have tabs (or whitespace of some description) after the break. In theory it should render with some indentation.

I was only looking at your screenshot above and wondered where the indentation was.
I think normally the exception message itself has intendation.
Will check this.

}

this.batchLogs.push(entry)
Expand Down
Loading