sergey-su / logjoint

LogJoint log viewer core. Viewer plugins for publicly-available domains.
MIT License
55 stars 13 forks source link

Request the ability to collapse rows to only show 1 line per row #40

Open sabrogden opened 6 months ago

sabrogden commented 6 months ago

Can i request a feature to be able to collapse all lines to a single row? Sometimes the lines are long and I only want to see 1 line then I'll open the message details to view the full message and next/prev through the list.

thanks scott

sergey-su commented 6 months ago

Did you create the log format in question? If so, you can modify it to show the multiline log messages as you prefer. The format can be edited using the user interface (in Add New Log Source dialog, press Manage formats...) or manually by editing the corresponding .format.xml file. I'll give examples of what can be put to the .format.xml file.

Assuming you have a regex capture named body, this code will collapse all line into one row:

<format>
  <regular-grammar>
    <fields-config>
      <field name="Body"><![CDATA[string.Join(" ", body.EnumLines())]]></field>
...

alternatively, this code will show only the first line of a multiline log message:

      <field name="Body"><![CDATA[body.EnumLines().FirstOrDefault(StringSlice.Empty)]]></field>

To be able to see the uncollapsed log, you may want to enable the raw log view

<format>
  ...
  <view-options>
    <raw-view-allowed>yes</raw-view-allowed>
    <preferred-view>normal</preferred-view>
  </view-options>
</format>